Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { test, describe, expect } from 'vitest';
import { makeArrayOrDefault } from './arrayHelper';
describe('Helper tests', () => {
describe('Make array or default', () => {
test('makeArrayOrDefault on undefined', () => {
const arr: any = undefined;
const arrVal = makeArrayOrDefault(arr);
expect(Array.isArray(arrVal)).toBeTruthy();
});
test('makeArrayOrDefault on null', () => {
const arr: any = null;
const arrVal = makeArrayOrDefault(arr);
expect(Array.isArray(arrVal)).toBeTruthy();
});
test('makeArrayOrDefault on null with defined value', () => {
const arr: any = null;
const defaultArr = ['test1', 'test2'];
const arrVal = makeArrayOrDefault(arr, defaultArr);
expect(Array.isArray(arrVal)).toBeTruthy();
expect(arrVal.length).toBe(defaultArr.length);
});
});
});
|