Files
directus/packages/shared/tests/utils/array-helpers.test.ts
Nicola Krumschmidt 81cd748c6d Add support for operation extensions to the Extensions SDK (#14410)
* Clean up extensions build logging

* Expose defineOperation* helpers through extensions-sdk

* Add support for scaffolding operation extensions

* Refactor extension type constants

* Improve extension-related tests in shared

* Improve wording when scaffolding extension fails due to wrong type

* Make spinner text bold when scaffolding extensions

* Add support for building operation extensions

* Fix operations tile name

* Make extension config type spacing consistent

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-07-25 11:36:52 -04:00

26 lines
731 B
TypeScript

import { isIn, isTypeIn } from '../../src/utils/array-helpers';
describe('type helpers for arrays', () => {
const array = ['foo', 'bar'] as const;
it('returns true when string is inside array', () => {
expect(isIn('foo', array)).toBe(true);
});
it('returns false when string is not inside array', () => {
expect(isIn('baz', array)).toBe(false);
});
it('returns true when object type string is inside array', () => {
expect(isTypeIn({ type: 'bar' }, array)).toBe(true);
});
it('returns false when object type string is not inside array', () => {
expect(isTypeIn({ type: 'baz' }, array)).toBe(false);
});
it('returns false when object has no type', () => {
expect(isTypeIn({}, array)).toBe(false);
});
});