@ryusei/light
Version:
<div align="center"> <a href="https://light.ryuseijs.com"> <img alt="RyuseiLight" src="https://light.ryuseijs.com/images/svg/logo.svg" width="70"> </a>
16 lines (12 loc) • 464 B
text/typescript
import { toArray } from './toArray';
describe( 'toArray', () => {
test( 'can push a provided value into an array.', () => {
expect( toArray( 1 ) ).toEqual( [ 1 ] );
expect( toArray( true ) ).toEqual( [ true ] );
expect( toArray( { a: 1 } ) ).toStrictEqual( [ { a: 1 } ] );
} );
test( 'should return a provided value itself if it is already an array.', () => {
const array = [ 1 ];
expect( toArray( array ) ).toBe( array );
} );
} );