@@ -53,7 +53,7 @@ const testCases: TestCase[] = [
5353 doc1 : null ,
5454 patches : [
5555 [ { op : 'add' , path : '' , value : { foo : [ { bar : 'baz' } ] } } ] ,
56- [ { op : 'str_ins' , path : '/foo/0/bar' , pos : 3 , str : '!' } ]
56+ [ { op : 'str_ins' , path : '/foo/0/bar' , pos : 3 , str : '!' } ] ,
5757 ] ,
5858 doc2 : { foo : [ { bar : 'baz!' } ] } ,
5959 } ,
@@ -62,73 +62,56 @@ const testCases: TestCase[] = [
6262 doc1 : null ,
6363 patches : [
6464 [ { op : 'add' , path : '' , value : { foo : [ { bar : 'baz' } ] } } ] ,
65- [ { op : 'str_ins' , path : [ 'foo' , 0 , 'bar' ] , pos : 3 , str : '!' } ]
65+ [ { op : 'str_ins' , path : [ 'foo' , 0 , 'bar' ] , pos : 3 , str : '!' } ] ,
6666 ] ,
6767 doc2 : { foo : [ { bar : 'baz!' } ] } ,
6868 } ,
6969 {
7070 name : 'can delete a single char' ,
7171 doc1 : 'a' ,
72- patches : [
73- [ { op : 'str_del' , path : [ ] , pos : 0 , len : 1 } ]
74- ] ,
72+ patches : [ [ { op : 'str_del' , path : [ ] , pos : 0 , len : 1 } ] ] ,
7573 doc2 : '' ,
7674 } ,
7775 {
7876 name : 'can delete from already empty string' ,
7977 doc1 : '' ,
80- patches : [
81- [ { op : 'str_del' , path : [ ] , pos : 0 , len : 1 } ]
82- ] ,
78+ patches : [ [ { op : 'str_del' , path : [ ] , pos : 0 , len : 1 } ] ] ,
8379 doc2 : '' ,
8480 } ,
8581 {
8682 name : 'can delete at the end of string' ,
8783 doc1 : 'ab' ,
88- patches : [
89- [ { op : 'str_del' , path : [ ] , pos : 1 , len : 1 } ]
90- ] ,
84+ patches : [ [ { op : 'str_del' , path : [ ] , pos : 1 , len : 1 } ] ] ,
9185 doc2 : 'a' ,
9286 } ,
9387 {
9488 name : 'can delete at the beginning of string' ,
9589 doc1 : 'ab' ,
96- patches : [
97- [ { op : 'str_del' , path : [ ] , pos : 0 , len : 1 } ]
98- ] ,
90+ patches : [ [ { op : 'str_del' , path : [ ] , pos : 0 , len : 1 } ] ] ,
9991 doc2 : 'b' ,
10092 } ,
10193 {
10294 name : 'can delete in the middle of string' ,
10395 doc1 : 'abc' ,
104- patches : [
105- [ { op : 'str_del' , path : [ ] , pos : 1 , len : 1 } ]
106- ] ,
96+ patches : [ [ { op : 'str_del' , path : [ ] , pos : 1 , len : 1 } ] ] ,
10797 doc2 : 'ac' ,
10898 } ,
10999 {
110100 name : 'can delete multiple chars' ,
111101 doc1 : '1234' ,
112- patches : [
113- [ { op : 'str_del' , path : [ ] , pos : 1 , len : 2 } ] ,
114- [ { op : 'str_del' , path : [ ] , pos : 1 , len : 5 } ] ,
115- ] ,
102+ patches : [ [ { op : 'str_del' , path : [ ] , pos : 1 , len : 2 } ] , [ { op : 'str_del' , path : [ ] , pos : 1 , len : 5 } ] ] ,
116103 doc2 : '1' ,
117104 } ,
118105 {
119106 name : 'handles deletion beyond end of string' ,
120107 doc1 : '1234' ,
121- patches : [
122- [ { op : 'str_del' , path : [ ] , pos : 1111 , len : 2 } ] ,
123- ] ,
108+ patches : [ [ { op : 'str_del' , path : [ ] , pos : 1111 , len : 2 } ] ] ,
124109 doc2 : '1234' ,
125110 } ,
126111 {
127112 name : 'can delete a string in object' ,
128113 doc1 : { foo : '123' } ,
129- patches : [
130- [ { op : 'str_del' , path : '/foo' , pos : 1 , len : 2 } ] ,
131- ] ,
114+ patches : [ [ { op : 'str_del' , path : '/foo' , pos : 1 , len : 2 } ] ] ,
132115 doc2 : { foo : '1' } ,
133116 } ,
134117] ;
0 commit comments