mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-06 01:15:28 +02:00
* Chore: extract variant creation arbitrary. * Feat: add "variants" as a required property on playground response * Wip: fix up some schema generation * Fix remaining openapi schemas * Fix: add missing variants property * Feat: test for variants * Feat: add `variants` property to playground response * Chore: update openapi snapshot
27 lines
877 B
TypeScript
27 lines
877 B
TypeScript
import fc, { Arbitrary } from 'fast-check';
|
|
import {
|
|
playgroundResponseSchema,
|
|
PlaygroundResponseSchema,
|
|
} from '../../../lib/openapi/spec/playground-response-schema';
|
|
import { validateSchema } from '../validate';
|
|
import { generate as generateInput } from './playground-request-schema.test';
|
|
import { generate as generateFeature } from './playground-feature-schema.test';
|
|
|
|
const generate = (): Arbitrary<PlaygroundResponseSchema> =>
|
|
fc.record({
|
|
input: generateInput(),
|
|
features: fc.uniqueArray(generateFeature(), {
|
|
selector: (feature) => feature.name,
|
|
}),
|
|
});
|
|
|
|
test('playgroundResponseSchema', () =>
|
|
fc.assert(
|
|
fc.property(
|
|
generate(),
|
|
(data: PlaygroundResponseSchema) =>
|
|
validateSchema(playgroundResponseSchema.$id, data) ===
|
|
undefined,
|
|
),
|
|
));
|