Skip to content

Commit

Permalink
Fi
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Jan 6, 2025
1 parent 41560bc commit 0d995eb
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 20 deletions.
27 changes: 27 additions & 0 deletions src/lib/openapi/spec/client-features-delta-schema.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { validateSchema } from '../validate';
import type { ClientFeaturesDeltaSchema } from './client-features-delta-schema';

test('clientFeaturesDeltaSchema all fields', () => {
const data: ClientFeaturesDeltaSchema = {
revisionId: 6,
updated: [
{
impressionData: false,
enabled: false,
name: 'base_feature',
description: null,
project: 'default',
stale: false,
type: 'release',
variants: [],
strategies: [],
},
],
removed: [],
segments: [],
};

expect(
validateSchema('#/components/schemas/clientFeaturesDeltaSchema', data),
).toBeUndefined();
});
37 changes: 17 additions & 20 deletions src/lib/openapi/spec/client-features-query-schema.test.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
import { validateSchema } from '../validate';
import type { ClientFeaturesDeltaSchema } from './client-features-delta-schema';
import type { ClientFeaturesQuerySchema } from './client-features-query-schema';

test('clientFeaturesDeltaSchema all fields', () => {
const data: ClientFeaturesDeltaSchema = {
revisionId: 6,
updated: [
{
impressionData: false,
enabled: false,
name: 'base_feature',
description: null,
project: 'default',
stale: false,
type: 'release',
variants: [],
strategies: [],
},
],
removed: [],
segments: [],
test('clientFeatureQuerySchema empty', () => {
const data: ClientFeaturesQuerySchema = {};

expect(
validateSchema('#/components/schemas/clientFeaturesQuerySchema', data),
).toBeUndefined();
});

test('clientFeatureQuerySchema all fields', () => {
const data: ClientFeaturesQuerySchema = {
tag: [['some-tag', 'some-other-tag']],
project: ['default'],
namePrefix: 'some-prefix',
environment: 'some-env',
inlineSegmentConstraints: true,
};

expect(
validateSchema('#/components/schemas/clientFeaturesDeltaSchema', data),
validateSchema('#/components/schemas/clientFeaturesQuerySchema', data),
).toBeUndefined();
});

0 comments on commit 0d995eb

Please sign in to comment.