mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 04:43:35 +00:00
refactor: migrate custom fields to transactions
refactor: extract functions to api domain refactor: strict custom field parsing refactor: remove rundown cache utilities refactor: directory restructure
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { isEmptyObject, removeUndefined } from '../parserUtils.js';
|
||||
import { isEmptyObject, makeString, removeUndefined } from '../parserUtils.js';
|
||||
|
||||
describe('isEmptyObject()', () => {
|
||||
test('finds an empty object', () => {
|
||||
@@ -32,3 +32,39 @@ describe('removeUndefined()', () => {
|
||||
expect(removeUndefined(obj)).toStrictEqual(obj);
|
||||
});
|
||||
});
|
||||
|
||||
describe('makeString()', () => {
|
||||
it('converts variables to string', () => {
|
||||
const cases = [
|
||||
{
|
||||
val: 2,
|
||||
expected: '2',
|
||||
},
|
||||
{
|
||||
val: 2.22222222,
|
||||
expected: '2.22222222',
|
||||
},
|
||||
{
|
||||
val: ['testing'],
|
||||
expected: 'testing',
|
||||
},
|
||||
{
|
||||
val: ' testing ',
|
||||
expected: 'testing',
|
||||
},
|
||||
{
|
||||
val: { doing: 'testing' },
|
||||
expected: 'fallback',
|
||||
},
|
||||
{
|
||||
val: undefined,
|
||||
expected: 'fallback',
|
||||
},
|
||||
];
|
||||
|
||||
cases.forEach(({ val, expected }) => {
|
||||
const converted = makeString(val, 'fallback');
|
||||
expect(converted).toBe(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user