We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 058217f commit 04011bfCopy full SHA for 04011bf
test/unit/specs/query.spec.js
@@ -9,6 +9,14 @@ describe('Query utils', () => {
9
baz: 'qux'
10
}))
11
})
12
+
13
+ it('should turn empty params into null', () => {
14
+ expect(resolveQuery('?foo&bar=&arr=1&arr&arr=2')).toEqual({
15
+ foo: null,
16
+ bar: '',
17
+ arr: ['1', null, '2']
18
+ })
19
20
21
22
describe('stringifyQuery', () => {
@@ -20,6 +28,14 @@ describe('Query utils', () => {
28
})).toBe('?foo=bar&baz=qux&arr=1&arr=2')
29
30
31
+ it('should add only the key with null', () => {
32
+ expect(stringifyQuery({
33
34
35
+ arr: [1, null, 3]
36
+ })).toBe('?foo&bar=&arr=1&arr&arr=3')
37
38
23
39
it('should escape reserved chars', () => {
24
40
expect(stringifyQuery({
25
41
a: '*()!'
0 commit comments