mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-12 13:48:35 +02:00
* refactor: extract InputCaption component * refactor: split up GeneralStrategy component * refactor: fill inn more default feature strategy parameter values * fix: validate feature strategy parameters * refactor: fix duplicate keys in strategy icon list * refactor: expand variable names * refactor: remove unnecessary useMemo * refactor: use captions instead of tooltips for boolean parameter descriptions * refactor: improve strategy definition form spacing
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",
|
|
},
|
|
}
|
|
`);
|
|
});
|