Skip to content

Commit

Permalink
added tests for lcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Arye Lukashevski committed Jun 28, 2018
1 parent 0c4323e commit 6afbbdc
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import * as jsondiffpatch from '../build/jsondiffpatch.esm';
import examples from './examples/diffpatch';
import chai from 'chai';

import lcs from '../src/filters/lcs';
const expect = chai.expect;

describe('jsondiffpatch', () => {
Expand Down Expand Up @@ -726,3 +728,27 @@ describe('DiffPatcher', () => {
});
});
});

describe('lcs', () => {
it('should lcs arrays ', () => {
expect(lcs.get([], [])).to.deep.equal({
sequence: [],
indices1: [],
indices2: [],
});

expect(lcs.get([1], [2])).to.deep.equal({
sequence: [],
indices1: [],
indices2: [],
});

// indices1 and indices2 show where the sequence
// elements are located in the original arrays
expect(lcs.get([ 1 ], [ -9, 1 ])).to.deep.equal({
sequence: [1],
indices1: [0],
indices2: [1],
});
});
});

0 comments on commit 6afbbdc

Please # to comment.