mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
parent
f8473a243f
commit
e226e31ad5
@ -120,6 +120,7 @@ export class FeatureEnvironmentStore implements IFeatureEnvironmentStore {
|
||||
enabled: r.enabled,
|
||||
featureName: r.feature_name,
|
||||
environment: r.environment,
|
||||
variants: r.variants,
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -5,15 +5,99 @@ test('exportResultSchema', () => {
|
||||
const data: ExportResultSchema = {
|
||||
features: [
|
||||
{
|
||||
name: 'test',
|
||||
name: 'some-toggle1',
|
||||
description: '',
|
||||
type: 'release',
|
||||
project: 'myproject',
|
||||
stale: false,
|
||||
impressionData: false,
|
||||
archived: false,
|
||||
},
|
||||
],
|
||||
featureStrategies: [
|
||||
{
|
||||
name: 'test',
|
||||
constraints: [],
|
||||
name: 'default',
|
||||
id: '784f2bc1-ba45-4a92-a6d6-a80e18a4e407',
|
||||
featureName: 'some-toggle1',
|
||||
parameters: {},
|
||||
constraints: [
|
||||
{
|
||||
values: ['ew'],
|
||||
inverted: false,
|
||||
operator: 'IN',
|
||||
contextName: 'appName',
|
||||
caseInsensitive: false,
|
||||
},
|
||||
{
|
||||
values: ['e'],
|
||||
inverted: false,
|
||||
operator: 'IN',
|
||||
contextName: 'userId',
|
||||
caseInsensitive: false,
|
||||
},
|
||||
],
|
||||
segments: [],
|
||||
},
|
||||
],
|
||||
featureEnvironments: [
|
||||
{
|
||||
enabled: true,
|
||||
featureName: 'some-toggle1',
|
||||
environment: 'development',
|
||||
variants: [
|
||||
{
|
||||
name: 'blue',
|
||||
weight: 500,
|
||||
overrides: [
|
||||
{ values: ['best'], contextName: 'appName' },
|
||||
],
|
||||
stickiness: 'default',
|
||||
weightType: 'variable',
|
||||
},
|
||||
{
|
||||
name: 'red',
|
||||
weight: 500,
|
||||
payload: { type: 'string', value: 'dsfsd' },
|
||||
overrides: [
|
||||
{ values: ['worst'], contextName: 'appName' },
|
||||
],
|
||||
stickiness: 'default',
|
||||
weightType: 'variable',
|
||||
},
|
||||
],
|
||||
name: 'some-toggle1',
|
||||
},
|
||||
],
|
||||
contextFields: [
|
||||
{
|
||||
name: 'appName',
|
||||
description: 'Allows you to constrain on application name',
|
||||
stickiness: false,
|
||||
sortOrder: 2,
|
||||
legalValues: [],
|
||||
},
|
||||
{
|
||||
name: 'userId',
|
||||
description: 'Allows you to constrain on userId',
|
||||
stickiness: false,
|
||||
sortOrder: 1,
|
||||
legalValues: [],
|
||||
},
|
||||
],
|
||||
featureTags: [
|
||||
{
|
||||
featureName: 'some-toggle',
|
||||
tagType: 'simple',
|
||||
tagValue: 'best-tag',
|
||||
},
|
||||
{ featureName: 'wat', tagType: 'simple', tagValue: 'best-tag' },
|
||||
{
|
||||
featureName: 'some-toggle1',
|
||||
tagType: 'simple',
|
||||
tagValue: 'best-tag',
|
||||
},
|
||||
],
|
||||
segments: [],
|
||||
};
|
||||
|
||||
expect(
|
||||
|
@ -2,6 +2,7 @@ import { FromSchema } from 'json-schema-to-ts';
|
||||
import { constraintSchema } from './constraint-schema';
|
||||
import { parametersSchema } from './parameters-schema';
|
||||
import { featureStrategySchema } from './feature-strategy-schema';
|
||||
import { variantSchema } from './variant-schema';
|
||||
|
||||
export const featureEnvironmentSchema = {
|
||||
$id: '#/components/schemas/featureEnvironmentSchema',
|
||||
@ -36,12 +37,19 @@ export const featureEnvironmentSchema = {
|
||||
$ref: '#/components/schemas/featureStrategySchema',
|
||||
},
|
||||
},
|
||||
variants: {
|
||||
type: 'array',
|
||||
items: {
|
||||
$ref: '#/components/schemas/variantSchema',
|
||||
},
|
||||
},
|
||||
},
|
||||
components: {
|
||||
schemas: {
|
||||
constraintSchema,
|
||||
parametersSchema,
|
||||
featureStrategySchema,
|
||||
variantSchema,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
@ -1164,6 +1164,12 @@ exports[`should serve the OpenAPI spec 1`] = `
|
||||
"variantCount": {
|
||||
"type": "number",
|
||||
},
|
||||
"variants": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/variantSchema",
|
||||
},
|
||||
"type": "array",
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
|
Loading…
Reference in New Issue
Block a user