Here's an example of how you could do diffing export const removedPath = (paths, target) => { return paths.filter(path => path !== target); }; import {removedPath} from './index'; const targetOne = [ [1, 1], [1, 2], [1, 3], [1, 4], ]; const targetTwo = [ [2, 1], [2, 2], [2, 3], [2, 4], ]; const originPath = [targetOne, targetTwo]; describe('removedPath', () => { test('should remove targetOne and left targetTwo', () => { const result = removedPath(originPath, targetOne); expect(result).toEqual([targetTwo]); }); test('should remove nothing', () => { const result = removedPath([targetTwo], targetOne); expect(result).toEqual([targetTwo]); }); });
