@@ -4,72 +4,72 @@ import { testEncodeDecode, testPatchUnpatch } from './utils'
44
55test ( 'Valid type' , function ( t ) {
66 const patch = { convert : TYPE . Replace ( { hello : 'world' } ) }
7- const expected = { convert : { $r : { hello : 'world' } } }
7+ const expected = { convert : { $e : { hello : 'world' } } }
88 testEncodeDecode ( t , patch , expected )
99} )
1010
1111test ( 'Escape' , function ( t ) {
12- const patch = { escape : { $r : 1 } }
13- const expected = { escape : { $escape : { $r : 1 } } }
12+ const patch = { escape : { $e : 1 } }
13+ const expected = { escape : { $escape : { $e : 1 } } }
1414 testEncodeDecode ( t , patch , expected )
1515} )
1616
1717test ( 'Ignore' , function ( t ) {
18- const patch = { ignore : { $r : 1 , $other : 1 } }
19- const expected = { ignore : { $r : 1 , $other : 1 } }
18+ const patch = { ignore : { $e : 1 , $other : 1 } }
19+ const expected = { ignore : { $e : 1 , $other : 1 } }
2020 testEncodeDecode ( t , patch , expected )
2121} )
2222
2323test ( '$escaping' , function ( t ) {
2424 const patch = {
2525 convert : TYPE . Replace ( [ 1 , 2 , 3 ] ) ,
26- escape : { $r : 1 } ,
26+ escape : { $e : 1 } ,
2727 }
2828 const expected = {
29- convert : { $r : [ 1 , 2 , 3 ] } ,
30- escape : { $escape : { $r : 1 } } ,
29+ convert : { $e : [ 1 , 2 , 3 ] } ,
30+ escape : { $escape : { $e : 1 } } ,
3131 }
3232 testEncodeDecode ( t , patch , expected )
3333} )
3434
35- test ( 'This should not be escaped because $r has another valid prop' , function ( t ) {
35+ test ( 'This should not be escaped because $e has another valid prop' , function ( t ) {
3636 const patch = {
3737 convert : TYPE . Replace ( [ 1 , 2 , 3 ] ) ,
38- ignored : { $r : [ 1 , 2 , 3 ] , $escape : [ 1 , 2 , 3 ] } ,
38+ ignored : { $e : [ 1 , 2 , 3 ] , $escape : [ 1 , 2 , 3 ] } ,
3939 }
4040 const expected = {
41- convert : { $r : [ 1 , 2 , 3 ] } ,
42- ignored : { $r : [ 1 , 2 , 3 ] , $escape : [ 1 , 2 , 3 ] } ,
41+ convert : { $e : [ 1 , 2 , 3 ] } ,
42+ ignored : { $e : [ 1 , 2 , 3 ] , $escape : [ 1 , 2 , 3 ] } ,
4343 }
4444 testEncodeDecode ( t , patch , expected )
4545} )
4646
47- test ( 'This should not be escaped because $r has another valid prop 2' , function ( t ) {
47+ test ( 'This should not be escaped because $e has another valid prop 2' , function ( t ) {
4848 const patch = {
4949 convert : TYPE . Replace ( [ 1 , 2 , 3 ] ) ,
50- escape : { $escape : [ 1 , 2 , 3 ] , $r : TYPE . Replace ( [ 1 , 2 , 3 ] ) } ,
50+ escape : { $escape : [ 1 , 2 , 3 ] , $e : TYPE . Replace ( [ 1 , 2 , 3 ] ) } ,
5151 }
5252 const expected = {
53- convert : { $r : [ 1 , 2 , 3 ] } ,
54- escape : { $escape : [ 1 , 2 , 3 ] , $r : { $r : [ 1 , 2 , 3 ] } } ,
53+ convert : { $e : [ 1 , 2 , 3 ] } ,
54+ escape : { $escape : [ 1 , 2 , 3 ] , $e : { $e : [ 1 , 2 , 3 ] } } ,
5555 }
5656 testEncodeDecode ( t , patch , expected )
5757} )
5858
5959test ( 'Decode alone' , function ( t ) {
6060 const patch = {
61- convert : { $r : [ 1 , 2 , 3 ] } ,
62- string : { $r : 'string' } ,
63- escape : { $escape : { $r : [ 1 , 2 , 3 ] } } ,
61+ convert : { $e : [ 1 , 2 , 3 ] } ,
62+ string : { $e : 'string' } ,
63+ escape : { $escape : { $e : [ 1 , 2 , 3 ] } } ,
6464 ignore : {
65- $escape : { $r : [ 1 , 2 , 3 ] } ,
66- two : { $r : [ 1 , 2 , 3 ] } ,
65+ $escape : { $e : [ 1 , 2 , 3 ] } ,
66+ two : { $e : [ 1 , 2 , 3 ] } ,
6767 } ,
6868 }
6969 const expected = {
7070 convert : TYPE . Replace ( [ 1 , 2 , 3 ] ) ,
7171 string : TYPE . Replace ( 'string' ) ,
72- escape : { $r : [ 1 , 2 , 3 ] } ,
72+ escape : { $e : [ 1 , 2 , 3 ] } ,
7373 ignore : {
7474 $escape : TYPE . Replace ( [ 1 , 2 , 3 ] ) ,
7575 two : TYPE . Replace ( [ 1 , 2 , 3 ] ) ,
0 commit comments