1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-01 01:18:10 +02:00
unleash.unleash/src/lib/openapi/spec/strategy-schema.test.ts
Thomas Heartman 46b4030d47
bug: mark descriptions on strategies as nullable (#4156)
This was omitted by mistake.

Fixes 1-1086
2023-07-06 13:39:23 +02:00

43 lines
1.0 KiB
TypeScript

import { validateSchema } from '../validate';
import { StrategySchema } from './strategy-schema';
test('strategySchema', () => {
const data: StrategySchema = {
description: '',
title: '',
name: '',
displayName: '',
editable: false,
deprecated: false,
parameters: [
{
name: '',
type: '',
description: '',
required: true,
},
],
};
expect(
validateSchema('#/components/schemas/strategySchema', data),
).toBeUndefined();
// allow null descriptions
expect(
validateSchema('#/components/schemas/strategySchema', {
...data,
description: null,
}),
).toBeUndefined();
expect(
validateSchema('#/components/schemas/strategySchema', {}),
).toMatchSnapshot();
const { title, ...noTitle } = { ...data };
expect(
validateSchema('#/components/schemas/strategySchema', noTitle),
).toBeUndefined();
});