@@ -4,10 +4,12 @@ describe('Query utils', () => {
4
4
describe ( 'resolveQuery' , ( ) => {
5
5
it ( 'should work' , ( ) => {
6
6
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
+ )
11
13
} )
12
14
13
15
it ( 'should turn empty params into null' , ( ) => {
@@ -21,31 +23,39 @@ describe('Query utils', () => {
21
23
22
24
describe ( 'stringifyQuery' , ( ) => {
23
25
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' )
29
33
} )
30
34
31
35
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' )
37
43
} )
38
44
39
45
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' )
43
51
} )
44
52
45
53
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' )
49
59
} )
50
60
} )
51
61
} )
0 commit comments