mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-18 11:14:57 +02:00
Fixes all warnings about the "key" prop. The majority of the fixes fall into one of the following categories: - Extracting "key" props in tables (you're not allowed to just spread them in) - Adding "key" props to autocomplete options and chips - fixing test data that didn't contain ids
105 lines
2.6 KiB
TypeScript
105 lines
2.6 KiB
TypeScript
import { testServerRoute, testServerSetup } from 'utils/testServer';
|
|
|
|
const server = testServerSetup();
|
|
|
|
export const setupProjectEndpoint = () => {
|
|
testServerRoute(server, '/api/admin/projects/default', {
|
|
environments: [
|
|
{
|
|
name: 'development',
|
|
enabled: true,
|
|
type: 'development',
|
|
},
|
|
],
|
|
});
|
|
};
|
|
|
|
export const setupSegmentsEndpoint = () => {
|
|
testServerRoute(server, '/api/admin/segments', {
|
|
segments: [
|
|
{
|
|
id: 1,
|
|
name: 'test',
|
|
constraints: [],
|
|
},
|
|
],
|
|
});
|
|
};
|
|
|
|
export const setupStrategyEndpoint = () => {
|
|
testServerRoute(server, '/api/admin/strategies/flexibleRollout', {
|
|
displayName: 'Gradual rollout',
|
|
name: 'flexibleRollout',
|
|
parameters: [
|
|
{
|
|
name: 'rollout',
|
|
},
|
|
{
|
|
name: 'stickiness',
|
|
},
|
|
{
|
|
name: 'groupId',
|
|
},
|
|
],
|
|
});
|
|
};
|
|
|
|
export const setupFeaturesEndpoint = (
|
|
featureName: string,
|
|
variantName = 'Blue',
|
|
) => {
|
|
testServerRoute(
|
|
server,
|
|
`/api/admin/projects/default/features/${featureName}`,
|
|
{
|
|
environments: [
|
|
{
|
|
name: 'development',
|
|
type: 'development',
|
|
strategies: [
|
|
{
|
|
id: '1',
|
|
constraints: [],
|
|
parameters: {
|
|
groupId: featureName,
|
|
rollout: '50',
|
|
stickiness: 'default',
|
|
},
|
|
name: 'flexibleRollout',
|
|
variants: [{ name: variantName, weight: 50 }],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
name: featureName,
|
|
project: 'default',
|
|
},
|
|
);
|
|
};
|
|
|
|
export const setupUiConfigEndpoint = () => {
|
|
testServerRoute(server, '/api/admin/ui-config', {
|
|
versionInfo: {
|
|
current: {
|
|
enterprise: '5.7.0-main',
|
|
},
|
|
},
|
|
environment: 'enterprise',
|
|
flags: {
|
|
newStrategyConfiguration: true,
|
|
},
|
|
resourceLimits: {
|
|
featureEnvironmentStrategies: 2,
|
|
},
|
|
unleashUrl: 'example.com',
|
|
});
|
|
};
|
|
|
|
export const setupContextEndpoint = () => {
|
|
testServerRoute(server, '/api/admin/context', [
|
|
{
|
|
name: 'appName',
|
|
},
|
|
]);
|
|
};
|