1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/features/export-import-toggles/import-context-validation.test.ts
2023-02-21 10:15:57 +01:00

34 lines
939 B
TypeScript

import { isValidField } from './import-context-validation';
test('has value context field', () => {
expect(
isValidField(
{ name: 'contextField', legalValues: [{ value: 'value1' }] },
[{ name: 'contextField', legalValues: [{ value: 'value1' }] }],
),
).toBe(true);
});
test('no matching field value', () => {
expect(
isValidField(
{ name: 'contextField', legalValues: [{ value: 'value1' }] },
[{ name: 'contextField', legalValues: [{ value: 'value2' }] }],
),
).toBe(false);
});
test('subset field value', () => {
expect(
isValidField(
{ name: 'contextField', legalValues: [{ value: 'value1' }] },
[
{
name: 'contextField',
legalValues: [{ value: 'value2' }, { value: 'value1' }],
},
],
),
).toBe(true);
});