Skip to content

Commit 6afbbdc

Browse files
author
Arye Lukashevski
committed
added tests for lcs
1 parent 0c4323e commit 6afbbdc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/index.js

+26
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import * as jsondiffpatch from '../build/jsondiffpatch.esm';
66
import examples from './examples/diffpatch';
77
import chai from 'chai';
8+
9+
import lcs from '../src/filters/lcs';
810
const expect = chai.expect;
911

1012
describe('jsondiffpatch', () => {
@@ -726,3 +728,27 @@ describe('DiffPatcher', () => {
726728
});
727729
});
728730
});
731+
732+
describe('lcs', () => {
733+
it('should lcs arrays ', () => {
734+
expect(lcs.get([], [])).to.deep.equal({
735+
sequence: [],
736+
indices1: [],
737+
indices2: [],
738+
});
739+
740+
expect(lcs.get([1], [2])).to.deep.equal({
741+
sequence: [],
742+
indices1: [],
743+
indices2: [],
744+
});
745+
746+
// indices1 and indices2 show where the sequence
747+
// elements are located in the original arrays
748+
expect(lcs.get([ 1 ], [ -9, 1 ])).to.deep.equal({
749+
sequence: [1],
750+
indices1: [0],
751+
indices2: [1],
752+
});
753+
});
754+
});

0 commit comments

Comments
 (0)