File "push.test.ts"

Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/utils/array/push/push.test.ts
File size: 561 B (561 B bytes)
MIME-type: text/x-java
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

import { push } from './push';


describe( 'push', () => {
  test( 'can push an item to an array.', () => {
    expect( push( [], 1 ) ).toEqual( [ 1 ] );
    expect( push( [ 1 ], 2 ) ).toEqual( [ 1, 2 ] );
  } );

  test( 'can push items to an array.', () => {
    expect( push( [], [ 1, 2, 3 ] ) ).toEqual( [ 1, 2, 3 ] );
    expect( push( [ 1, 2, 3 ], [ 4, 5, 6 ] ) ).toEqual( [ 1, 2, 3, 4, 5, 6 ] );
  } );

  test( 'should return the provided array itself.', () => {
    const array: number[] = [];
    expect( push( array, 1 ) ).toBe( array );
  } );
} );