1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/src/lib/openapi/spec/context-field-schema.test.ts
Nuno Góis 525fce3e86
refactor: add OpenAPI schema to context controller (#1711)
* refactor: add OpenAPI schema to context controller

* Update src/lib/routes/admin-api/context.ts

Co-authored-by: olav <mail@olav.io>

* address PR comments, misc fixes and improvements

* refactor: address PR comments

* add createdAt to test

* fix: reverted upsert schema after discussion

Co-authored-by: olav <mail@olav.io>
2022-06-17 10:11:55 +01:00

24 lines
620 B
TypeScript

import { validateSchema } from '../validate';
import { ContextFieldSchema } from './context-field-schema';
test('contextFieldSchema', () => {
const data: ContextFieldSchema = {
name: '',
description: '',
stickiness: false,
sortOrder: 0,
createdAt: '2022-01-01T00:00:00.000Z',
legalValues: [],
};
expect(
validateSchema('#/components/schemas/contextFieldSchema', data),
).toBeUndefined();
});
test('contextFieldSchema empty', () => {
expect(
validateSchema('#/components/schemas/contextFieldSchema', {}),
).toMatchSnapshot();
});