1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/util/ensureStringValue.test.ts
olav b2b0958573
fix: ensure that param values from /api/admin/features are strings (#1761)
* refactor: improve parameter value string casting

* fix: ensure that param values from /api/admin/features are strings
2022-06-29 10:11:34 +02:00

17 lines
626 B
TypeScript

import { ensureStringValue } from './ensureStringValue';
test('ensureStringValue', () => {
expect(ensureStringValue(null)).toEqual('');
expect(ensureStringValue(undefined)).toEqual('');
expect(ensureStringValue('null')).toEqual('null');
expect(ensureStringValue('undefined')).toEqual('undefined');
expect(ensureStringValue('')).toEqual('');
expect(ensureStringValue('a')).toEqual('a');
expect(ensureStringValue(0)).toEqual('0');
expect(ensureStringValue(true)).toEqual('true');
expect(ensureStringValue({})).toEqual('{}');
expect(ensureStringValue({ b: 1 })).toEqual('{"b":1}');
});