mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
53354224fc
Upgrades biome to 1.6.1, and updates husky pre-commit hook. Most changes here are making type imports explicit.
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import fc, { type Arbitrary } from 'fast-check';
|
|
import { urlFriendlyString } from '../../../test/arbitraries.test';
|
|
import {
|
|
playgroundRequestSchema,
|
|
type PlaygroundRequestSchema,
|
|
} from '../../../lib/openapi/spec/playground-request-schema';
|
|
import { validateSchema } from '../validate';
|
|
import { generate as generateContext } from './sdk-context-schema.test';
|
|
|
|
export const generate = (): Arbitrary<PlaygroundRequestSchema> =>
|
|
fc.record({
|
|
environment: fc.oneof(
|
|
fc.constantFrom('development', 'production', 'default'),
|
|
fc.lorem({ maxCount: 1 }),
|
|
),
|
|
projects: fc.oneof(
|
|
fc.uniqueArray(
|
|
fc.oneof(fc.lorem({ maxCount: 1 }), urlFriendlyString()),
|
|
),
|
|
fc.constant('*' as const),
|
|
),
|
|
context: generateContext(),
|
|
});
|
|
|
|
test('playgroundRequestSchema', () =>
|
|
fc.assert(
|
|
fc.property(
|
|
generate(),
|
|
(data: PlaygroundRequestSchema) =>
|
|
validateSchema(playgroundRequestSchema.$id, data) === undefined,
|
|
),
|
|
));
|