1 import lastItem from './lastItem';
3 describe('lastItem()', () => {
4 it('should return undefined when array is empty', () => {
5 const result = lastItem([]);
7 expect(result).toBe(undefined);
10 it('should return only item when array is of length 1', () => {
12 const result = lastItem([item]);
14 expect(result).toBe(item);
17 it('should return last item when array is of length greater than 1', () => {
19 const result = lastItem(['1', '2', item]);
21 expect(result).toBe(item);