From 0d995eb25cdcab56cb12f8cdfd44743fc6de53c4 Mon Sep 17 00:00:00 2001 From: sjaanus Date: Mon, 6 Jan 2025 13:37:55 +0200 Subject: [PATCH] Fi --- .../spec/client-features-delta-schema.test.ts | 27 ++++++++++++++ .../spec/client-features-query-schema.test.ts | 37 +++++++++---------- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/src/lib/openapi/spec/client-features-delta-schema.test.ts b/src/lib/openapi/spec/client-features-delta-schema.test.ts index e69de29bb2d1..0510137771e6 100644 --- a/src/lib/openapi/spec/client-features-delta-schema.test.ts +++ b/src/lib/openapi/spec/client-features-delta-schema.test.ts @@ -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(); +}); diff --git a/src/lib/openapi/spec/client-features-query-schema.test.ts b/src/lib/openapi/spec/client-features-query-schema.test.ts index 0510137771e6..19508656be9b 100644 --- a/src/lib/openapi/spec/client-features-query-schema.test.ts +++ b/src/lib/openapi/spec/client-features-query-schema.test.ts @@ -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(); });