Files
directus/packages/shared/tests/utils/is-dynamic-variable.test.ts
2022-05-27 12:43:54 -04:00

21 lines
482 B
TypeScript

import { isDynamicVariable } from '../../src/utils/is-dynamic-variable';
const tests: [string, boolean][] = [
['$NOW', true],
['$NOW(- 1 year)', true],
['test', false],
['$CUSTOM', false],
['$CURRENT_USER', true],
['$CURRENT_ROLE', true],
['$CURRENT_USER.role.name', true],
['$CURRENT_ROLE.users.id', true],
];
describe('is extension type', () => {
for (const [value, result] of tests) {
it(value, () => {
expect(isDynamicVariable(value)).toBe(result);
});
}
});