1 import addItem from './addItem';
3 describe('addItem()', () => {
4 it('adds item to empty array', () => {
5 const item = 'item to add';
7 const result = addItem([], item);
9 expect(result).toStrictEqual([item]);
12 it('appends item to ends of array', () => {
13 const array = ['item 1', 'item 2', 'item 3'];
14 const item = 'item to add';
16 const result = addItem(array, item);
18 expect(result).toStrictEqual([...array, item]);