1import { findLastIndex, intersecting, replaceValue } from '../array'; 2 3describe(findLastIndex, () => { 4 it('should return the last index of an item based on a given criteria', () => { 5 const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; 6 const predicate = (item: number) => item % 2 === 0; 7 expect(findLastIndex(array, predicate)).toBe(9); 8 }); 9}); 10 11describe(intersecting, () => { 12 it('should return a list of items that intersect between two given arrays', () => { 13 const a = [1, 2, 3]; 14 const b = [1, 2, 3, 4, 5, 6]; 15 expect(intersecting(a, b)).toEqual([1, 2, 3]); 16 }); 17}); 18 19describe(replaceValue, () => { 20 it(`should replace a value in an array`, () => { 21 expect(replaceValue([1, 2, 3], 1, 2)).toEqual([2, 2, 3]); 22 expect(replaceValue([1, 2, 3], 4, 5)).toEqual([1, 2, 3]); 23 }); 24}); 25