Files
directus/packages/shared/src/utils/is-dynamic-variable.test.ts
Rijk van Zanten 65291b95c4 Allow dynamic user variables to be used with filter rules (cont.) (#9376)
* Move permissions extraction to accountability

* Fix permissions retrieval for public user

* Fetch user / role context in permissions middleware

* Remove unnecessary parseFilter

* Rename schemaCache to systemCache

* Add permissions caching

* Add system cache invalidation on permission changes

* Improve caching perf by reducing scope

* Add note to docs

* Clarify compatibility with conditional fields/filters

* Fix lint warning

* Allow nested vars in system-filter-input

* Add custom getter function that resolves arrays

* Add is-dynamic-variable util

* Export new util

* Cleanup parse filter

* Fix build

* Move debounce up to use-items

* Remove unused prop

* 🧹

* Fix input pattern usage w/ vars

* Remove debounce from search-input, increase throttle
2021-11-03 16:56:16 -04:00

21 lines
468 B
TypeScript

import { isDynamicVariable } from './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);
});
}
});