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

34 lines
939 B
TypeScript
Raw Normal View History

2023-02-16 08:08:51 +01:00
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);
});