2022-08-04 13:34:30 +02:00
|
|
|
import { createFeatureStrategy } from 'utils/createFeatureStrategy';
|
|
|
|
|
|
|
|
test('createFeatureStrategy', () => {
|
|
|
|
expect(
|
|
|
|
createFeatureStrategy('a', {
|
|
|
|
name: 'b',
|
|
|
|
displayName: 'c',
|
|
|
|
editable: true,
|
|
|
|
deprecated: false,
|
|
|
|
description: 'd',
|
|
|
|
parameters: [],
|
|
|
|
})
|
|
|
|
).toMatchInlineSnapshot(`
|
|
|
|
{
|
|
|
|
"constraints": [],
|
|
|
|
"name": "b",
|
|
|
|
"parameters": {},
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('createFeatureStrategy with parameters', () => {
|
|
|
|
expect(
|
|
|
|
createFeatureStrategy('a', {
|
|
|
|
name: 'b',
|
|
|
|
displayName: 'c',
|
|
|
|
editable: true,
|
|
|
|
deprecated: false,
|
|
|
|
description: 'd',
|
|
|
|
parameters: [
|
|
|
|
{
|
|
|
|
name: 'groupId',
|
|
|
|
type: 'string',
|
|
|
|
description: 'a',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'stickiness',
|
|
|
|
type: 'string',
|
|
|
|
description: 'a',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'rollout',
|
|
|
|
type: 'percentage',
|
|
|
|
description: 'a',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 's',
|
|
|
|
type: 'string',
|
|
|
|
description: 's',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'b',
|
|
|
|
type: 'boolean',
|
|
|
|
description: 'b',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
})
|
|
|
|
).toMatchInlineSnapshot(`
|
|
|
|
{
|
|
|
|
"constraints": [],
|
|
|
|
"name": "b",
|
|
|
|
"parameters": {
|
|
|
|
"b": "false",
|
|
|
|
"groupId": "a",
|
|
|
|
"rollout": "50",
|
|
|
|
"s": "",
|
2023-03-10 11:28:02 +01:00
|
|
|
"stickiness": "",
|
2022-08-04 13:34:30 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
});
|