mirror of
https://github.com/directus/directus.git
synced 2026-02-04 08:45:11 -05:00
* 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>
26 lines
731 B
TypeScript
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);
|
|
});
|
|
});
|