File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 5
5
import * as jsondiffpatch from '../build/jsondiffpatch.esm' ;
6
6
import examples from './examples/diffpatch' ;
7
7
import chai from 'chai' ;
8
+
9
+ import lcs from '../src/filters/lcs' ;
8
10
const expect = chai . expect ;
9
11
10
12
describe ( 'jsondiffpatch' , ( ) => {
@@ -726,3 +728,27 @@ describe('DiffPatcher', () => {
726
728
} ) ;
727
729
} ) ;
728
730
} ) ;
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments