@@ -4,10 +4,12 @@ describe('Query utils', () => {
44 describe ( 'resolveQuery' , ( ) => {
55 it ( 'should work' , ( ) => {
66 const query = resolveQuery ( 'foo=bar&foo=k' , { baz : 'qux' } )
7- expect ( JSON . stringify ( query ) ) . toBe ( JSON . stringify ( {
8- foo : [ 'bar' , 'k' ] ,
9- baz : 'qux'
10- } ) )
7+ expect ( JSON . stringify ( query ) ) . toBe (
8+ JSON . stringify ( {
9+ foo : [ 'bar' , 'k' ] ,
10+ baz : 'qux'
11+ } )
12+ )
1113 } )
1214
1315 it ( 'should turn empty params into null' , ( ) => {
@@ -21,31 +23,39 @@ describe('Query utils', () => {
2123
2224 describe ( 'stringifyQuery' , ( ) => {
2325 it ( 'should work' , ( ) => {
24- expect ( stringifyQuery ( {
25- foo : 'bar' ,
26- baz : 'qux' ,
27- arr : [ 1 , 2 ]
28- } ) ) . toBe ( '?foo=bar&baz=qux&arr=1&arr=2' )
26+ expect (
27+ stringifyQuery ( {
28+ foo : 'bar' ,
29+ baz : 'qux' ,
30+ arr : [ 1 , 2 ]
31+ } )
32+ ) . toBe ( '?foo=bar&baz=qux&arr=1&arr=2' )
2933 } )
3034
3135 it ( 'should add only the key with null' , ( ) => {
32- expect ( stringifyQuery ( {
33- foo : null ,
34- bar : '' ,
35- arr : [ 1 , null , 3 ]
36- } ) ) . toBe ( '?foo&bar=&arr=1&arr&arr=3' )
36+ expect (
37+ stringifyQuery ( {
38+ foo : null ,
39+ bar : '' ,
40+ arr : [ 1 , null , 3 ]
41+ } )
42+ ) . toBe ( '?foo&bar=&arr=1&arr&arr=3' )
3743 } )
3844
3945 it ( 'should escape reserved chars' , ( ) => {
40- expect ( stringifyQuery ( {
41- a : '*()!'
42- } ) ) . toBe ( '?a=%2a%28%29%21' )
46+ expect (
47+ stringifyQuery ( {
48+ a : '*()!'
49+ } )
50+ ) . toBe ( '?a=%2a%28%29%21' )
4351 } )
4452
4553 it ( 'should preserve commas' , ( ) => {
46- expect ( stringifyQuery ( {
47- list : '1,2,3'
48- } ) ) . toBe ( '?list=1,2,3' )
54+ expect (
55+ stringifyQuery ( {
56+ list : '1,2,3'
57+ } )
58+ ) . toBe ( '?list=1,2,3' )
4959 } )
5060 } )
5161} )
0 commit comments