mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
|
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": "",
|
||
|
"stickiness": "default",
|
||
|
},
|
||
|
}
|
||
|
`);
|
||
|
});
|