mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-18 01:18:23 +02:00
We are changing how the Delta API works, as discussed: 1. We have removed the `updated` and `removed` arrays and now keep everything in the `events` array. 2. We decided to keep the hydration cache separate from the events array internally. Since the hydration cache has a special structure and may contain not just one feature but potentially 1,000 features, it behaved differently, requiring a lot of special logic to handle it. 3. Implemented `nameprefix` filtering, which we were missing before. Things still to implement: 1. Segment hydration and updates to it.
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { validateSchema } from '../validate';
|
|
import type { ClientFeaturesDeltaSchema } from './client-features-delta-schema';
|
|
|
|
test('clientFeaturesDeltaSchema all fields', () => {
|
|
const data: ClientFeaturesDeltaSchema = {
|
|
events: [
|
|
{
|
|
eventId: 1,
|
|
type: 'feature-removed',
|
|
featureName: 'removed-event',
|
|
},
|
|
{
|
|
eventId: 1,
|
|
type: 'feature-updated',
|
|
feature: {
|
|
impressionData: false,
|
|
enabled: false,
|
|
name: 'base_feature',
|
|
description: null,
|
|
project: 'default',
|
|
stale: false,
|
|
type: 'release',
|
|
variants: [],
|
|
strategies: [],
|
|
},
|
|
},
|
|
{
|
|
eventId: 1,
|
|
type: 'segment-removed',
|
|
segmentId: 33,
|
|
},
|
|
{
|
|
eventId: 1,
|
|
type: 'segment-updated',
|
|
segment: {
|
|
id: 3,
|
|
name: 'hello',
|
|
constraints: [],
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
expect(
|
|
validateSchema('#/components/schemas/clientFeaturesDeltaSchema', data),
|
|
).toBeUndefined();
|
|
});
|