mirror of
https://github.com/directus/directus.git
synced 2026-01-14 20:57:58 -05:00
* Improve env variable casting for already typed variables configured through .[c]js files * Revert back to using dedicated toX functions and extended toBoolean to handle boolean type values * Some additions to test and removed some redundant code in toBoolean * Fix test case name * Add changeset * Change changeset
19 lines
370 B
TypeScript
19 lines
370 B
TypeScript
import { expect, test } from 'vitest';
|
|
import { toBoolean } from './to-boolean.js';
|
|
|
|
test.each([
|
|
['true', true],
|
|
[true, true],
|
|
['1', true],
|
|
[1, true],
|
|
['false', false],
|
|
['anything', false],
|
|
[123, false],
|
|
[{}, false],
|
|
[['{}'], false],
|
|
[true, true],
|
|
[false, false],
|
|
])('toBoolean(%s) -> %s', (value, expected) => {
|
|
expect(toBoolean(value)).toBe(expected);
|
|
});
|