@@ -133,7 +133,7 @@ describe('useFetch - BROWSER - basic functionality', (): void => {
133
133
} )
134
134
135
135
describe ( 'useFetch - handling host/path/route parsing properly' , ( ) : void => {
136
- it ( 'should have addSlash run properly' , ( ) : void => {
136
+ it ( 'should have addSlash run properly' , ( ) : void => {
137
137
expect ( addSlash ( '' , '' ) ) . toBe ( '' )
138
138
expect ( addSlash ( '' ) ) . toBe ( '' )
139
139
expect ( addSlash ( '?foo=bar' , 'a.com' ) ) . toBe ( '?foo=bar' )
@@ -145,6 +145,9 @@ describe('useFetch - handling host/path/route parsing properly', (): void => {
145
145
expect ( addSlash ( 'foo' , 'a.com/' ) ) . toBe ( 'foo' )
146
146
expect ( addSlash ( 'foo' ) ) . toBe ( '/foo' )
147
147
expect ( addSlash ( '/foo' ) ) . toBe ( '/foo' )
148
+ expect ( addSlash ( 'bar' , 'a.com?foo=' ) ) . toBe ( 'bar' )
149
+ expect ( addSlash ( '&foo=bar' , 'a.com?b=k' ) ) . toBe ( '&foo=bar' )
150
+ expect ( addSlash ( '&foo=bar' ) ) . toBe ( '&foo=bar' )
148
151
} )
149
152
} )
150
153
@@ -159,7 +162,7 @@ describe('useFetch - responseType', (): void => {
159
162
fetch . resetMocks ( )
160
163
fetch . mockResponseOnce ( 'Alex Cory' )
161
164
const { result, waitForNextUpdate } = renderHook (
162
- ( ) => useFetch ( 'a-fake-url' , { data : '' , responseType : 'json' } , [ ] ) , // onMount === true
165
+ ( ) => useFetch ( 'a-fake-url' , { data : '' , responseType : 'json' } , [ ] ) // onMount === true
163
166
)
164
167
expect ( result . current . data ) . toEqual ( '' )
165
168
expect ( result . current . loading ) . toBe ( true )
@@ -174,7 +177,7 @@ describe('useFetch - responseType', (): void => {
174
177
const expectedString = 'Alex Cory'
175
178
fetch . mockResponseOnce ( JSON . stringify ( expectedString ) )
176
179
const { result, waitForNextUpdate } = renderHook (
177
- ( ) => useFetch ( 'a-fake-url' , { data : '' } , [ ] ) , // onMount === true
180
+ ( ) => useFetch ( 'a-fake-url' , { data : '' } , [ ] ) // onMount === true
178
181
)
179
182
expect ( result . current . data ) . toEqual ( '' )
180
183
expect ( result . current . loading ) . toBe ( true )
@@ -203,7 +206,7 @@ describe('useFetch - BROWSER - with <Provider />', (): void => {
203
206
fetch . mockResponseOnce ( JSON . stringify ( expected ) )
204
207
} )
205
208
206
- it ( ` should work correctly: useFetch({ data: [] }, [])` , async ( ) : Promise < void > => {
209
+ it ( ' should work correctly: useFetch({ data: [] }, [])' , async ( ) : Promise < void > => {
207
210
const { result, waitForNextUpdate } = renderHook (
208
211
( ) => useFetch ( { data : { } } , [ ] ) , // onMount === true
209
212
{ wrapper }
@@ -294,7 +297,7 @@ describe('useFetch - BROWSER - with <Provider />', (): void => {
294
297
expect ( fetch . mock . calls . length ) . toBe ( 2 )
295
298
} )
296
299
297
- it ( ` should execute GET using Provider url: useFetch('/people', [])` , async ( ) : Promise <
300
+ it ( ' should execute GET using Provider url: useFetch(\ '/people\ ', [])' , async ( ) : Promise <
298
301
void
299
302
> => {
300
303
const { result, waitForNextUpdate } = renderHook (
@@ -711,7 +714,7 @@ describe('useFetch - BROWSER - interceptors', (): void => {
711
714
return response
712
715
}
713
716
}
714
- } , [ ] ) ,
717
+ } , [ ] )
715
718
)
716
719
await waitForNextUpdate ( )
717
720
await act ( result . current . get )
@@ -1138,7 +1141,7 @@ describe('useFetch - BROWSER - errors', (): void => {
1138
1141
} )
1139
1142
1140
1143
it ( 'should set the `error` with custom errors' , async ( ) : Promise < void > => {
1141
- const customError = { id : 'Custom Error' }
1144
+ const customError = { id : 'Custom Error' }
1142
1145
fetch . resetMocks ( )
1143
1146
fetch . mockResponse ( ( ) => Promise . reject ( customError ) )
1144
1147
const { result } = renderHook (
0 commit comments