mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
013efac46b
We love all open-source Unleash users. in 2022 we built the [segment capability](https://docs.getunleash.io/reference/segments) (v4.13) as an enterprise feature, simplify life for our customers. Now it is time to contribute it to the world 🌏 --------- Co-authored-by: Thomas Heartman <thomas@getunleash.io>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
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();
|
|
});
|
|
});
|