UNPKG

@qntm-code/utils

Version:

A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.

12 lines (11 loc) 413 B
import { toArray } from './to-array'; describe('toArray', () => { it('should return the provided value if it is already an array', () => { const value = ['a', 'b']; expect(toArray(value)).toBe(value); }); it('should return the provided value in a new array if it is not already an array', () => { const value = 'a'; expect(toArray(value)).toEqual([value]); }); });