1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00
unleash.unleash/src/lib/openapi/spec/admin-strategies-schema.test.ts

44 lines
1.1 KiB
TypeScript
Raw Normal View History

import { validateSchema } from '../validate';
test('segmentStrategiesSchema', () => {
const validExamples = [
{ strategies: [] },
{
strategies: [
{
id: 'test',
projectId: '2',
featureName: 'featureName',
strategyName: 'strategyName',
environment: 'environment',
},
],
},
];
validExamples.forEach((obj) => {
expect(
validateSchema('#/components/schemas/segmentStrategiesSchema', obj),
).toBeUndefined();
});
const invalidExamples = [
'not an object',
{},
{ notStrategies: [] },
{
strategies: [
{
featureName: 'featureName',
strategyName: 'strategyName',
environment: 'environment',
},
],
},
];
invalidExamples.forEach((obj) => {
expect(
validateSchema('#/components/schemas/segmentStrategiesSchema', obj),
).toMatchSnapshot();
});
});