@@ -23,7 +23,8 @@ describe('URI normalizing', () => {
23
23
'/camps?page=0&abc=123&page=1' : '/camps?abc=123&page=0&page=1' ,
24
24
'/camps?page=1&abc=123&page=0' : '/camps?abc=123&page=1&page=0' ,
25
25
'/camps?page=0&xyz=123&page=1' : '/camps?page=0&page=1&xyz=123' ,
26
- '/camps/?e[]=abc&a[]=123&a=test' : '/camps/?a=test&a%5B%5D=123&e%5B%5D=abc'
26
+ '/camps/?e[]=abc&a[]=123&a=test' :
27
+ '/camps/?a=test&a%5B%5D=123&e%5B%5D=abc'
27
28
}
28
29
29
30
Object . entries ( examples ) . forEach ( ( [ example , expected ] ) => {
@@ -45,7 +46,7 @@ describe('URI normalizing', () => {
45
46
expect ( result ) . toEqual ( null )
46
47
} )
47
48
48
- it ( ' treats undefined as root URI, to enable this.api.get() without parameters to be the same as this.api.get(\'\')' , ( ) => {
49
+ it ( " treats undefined as root URI, to enable this.api.get() without parameters to be the same as this.api.get('')" , ( ) => {
49
50
// given
50
51
51
52
// when
@@ -55,7 +56,7 @@ describe('URI normalizing', () => {
55
56
expect ( result ) . toEqual ( '' )
56
57
} )
57
58
58
- it ( ' treats undefined as root URI, to enable this.api.get() without parameters to be the same as this.api.get(\'\')' , ( ) => {
59
+ it ( " treats undefined as root URI, to enable this.api.get() without parameters to be the same as this.api.get('')" , ( ) => {
59
60
// given
60
61
61
62
// when
@@ -65,59 +66,68 @@ describe('URI normalizing', () => {
65
66
expect ( result ) . toEqual ( '' )
66
67
} )
67
68
68
- const baseUrlParams =
69
- [
70
- {
71
- baseUrl : undefined ,
72
- uri : '/api/activities' ,
73
- normalized : '/api/activities'
74
- } ,
75
- {
76
- baseUrl : null ,
77
- uri : '/api/activities' ,
78
- normalized : '/api/activities'
79
- } ,
80
- {
81
- baseUrl : '' ,
82
- uri : '/api/activities' ,
83
- normalized : '/api/activities'
84
- } ,
85
- {
86
- baseUrl : '/api' ,
87
- uri : '/api/activities' ,
88
- normalized : '/activities'
89
- } ,
90
- {
91
- baseUrl : 'http://localhost:3000' ,
92
- uri : 'http://localhost:3000/api/activities' ,
93
- normalized : '/api/activities'
94
- } ,
95
- {
96
- baseUrl : 'http://localhost:3000' ,
97
- uri : '/api/activities' ,
98
- normalized : '/api/activities'
99
- } ,
100
- {
101
- baseUrl : 'http://localhost:3000/api' ,
102
- uri : 'http://localhost:3000/api/activities' ,
103
- normalized : '/activities'
104
- } ,
105
- {
106
- baseUrl : 'http://localhost:3000/api' ,
107
- uri : '/api/activities' ,
108
- normalized : '/activities'
109
- } ,
110
- {
111
- baseUrl : 'http://localhost:3000/api/' ,
112
- uri : '/api/activities' ,
113
- normalized : '/activities'
114
- } ,
115
- {
116
- baseUrl : 'http://localhost:3000/api/' ,
117
- uri : 'http://localhost:3000/print/activities' ,
118
- normalized : 'http://localhost:3000/print/activities'
119
- }
120
- ]
69
+ const baseUrlParams = [
70
+ {
71
+ baseUrl : undefined ,
72
+ uri : '/api/activities' ,
73
+ normalized : '/api/activities'
74
+ } ,
75
+ {
76
+ baseUrl : null ,
77
+ uri : '/api/activities' ,
78
+ normalized : '/api/activities'
79
+ } ,
80
+ {
81
+ baseUrl : '' ,
82
+ uri : '/api/activities' ,
83
+ normalized : '/api/activities'
84
+ } ,
85
+ {
86
+ baseUrl : '/api' ,
87
+ uri : '/api/activities' ,
88
+ normalized : '/activities'
89
+ } ,
90
+ {
91
+ baseUrl : 'http://localhost:3000' ,
92
+ uri : 'http://localhost:3000/api/activities' ,
93
+ normalized : '/api/activities'
94
+ } ,
95
+ {
96
+ baseUrl : 'http://localhost:3000' ,
97
+ uri : '/api/activities' ,
98
+ normalized : '/api/activities'
99
+ } ,
100
+ {
101
+ baseUrl : 'http://localhost:3000/api' ,
102
+ uri : 'http://localhost:3000/api/activities' ,
103
+ normalized : '/activities'
104
+ } ,
105
+ {
106
+ baseUrl : 'http://localhost:3000/api' ,
107
+ uri : '/api/activities' ,
108
+ normalized : '/activities'
109
+ } ,
110
+ {
111
+ baseUrl : 'http://localhost:3000/api/' ,
112
+ uri : '/api/activities' ,
113
+ normalized : '/activities'
114
+ } ,
115
+ {
116
+ baseUrl : 'http://localhost:3000/api/' ,
117
+ uri : 'http://localhost:3000/print/activities' ,
118
+ normalized : 'http://localhost:3000/print/activities'
119
+ } ,
120
+ {
121
+ baseUrl : 'http://localhost:3000/api/' ,
122
+ uri : '/api/activities?page=0&abc=123' ,
123
+ normalized : '/activities?abc=123&page=0'
124
+ } ,
125
+ {
126
+ baseUrl : '/api' ,
127
+ uri : '/api/activities?page=0&abc=123' ,
128
+ normalized : '/activities?abc=123&page=0'
129
+ }
130
+ ]
121
131
122
132
baseUrlParams . forEach ( ( { baseUrl, uri, normalized } ) => {
123
133
it ( `normalizes ${ uri } when baseUrl is ${ baseUrl } to ${ normalized } ` , ( ) => {
0 commit comments