@@ -29,7 +29,7 @@ describe('testing mockResponse and alias once', () => {
29
29
30
30
expect ( response ) . toEqual ( [
31
31
{ secret_data : '12345' } ,
32
- { secret_data : '67891' }
32
+ { secret_data : '67891' } ,
33
33
] )
34
34
35
35
expect ( fetch . mock . calls . length ) . toEqual ( 2 )
@@ -61,7 +61,7 @@ describe('testing mockResponse and alias once', () => {
61
61
62
62
expect ( response ) . toEqual ( [
63
63
{ secret_data : '12345' } ,
64
- { secret_data : '67891' }
64
+ { secret_data : '67891' } ,
65
65
] )
66
66
67
67
expect ( fetch . mock . calls . length ) . toEqual ( 2 )
@@ -86,7 +86,7 @@ describe('testing mockResponses', () => {
86
86
const response = await APIRequest ( 'facebook' )
87
87
expect ( response ) . toEqual ( [
88
88
{ name : 'naruto' , average_score : 79 } ,
89
- { name : 'bleach' , average_score : 68 }
89
+ { name : 'bleach' , average_score : 68 } ,
90
90
] )
91
91
expect ( fetch . mock . calls . length ) . toEqual ( 2 )
92
92
@@ -157,13 +157,13 @@ describe('request', () => {
157
157
const url = 'http://foo.bar/'
158
158
const requestInit = {
159
159
headers : {
160
- foo : 'bar'
161
- }
160
+ foo : 'bar' ,
161
+ } ,
162
162
}
163
163
const responseInit = {
164
164
headers : {
165
- bing : 'dang'
166
- }
165
+ bing : 'dang' ,
166
+ } ,
167
167
}
168
168
const response = 'foobarbang'
169
169
fetch . mockResponse ( ( input ) => {
@@ -180,12 +180,12 @@ describe('request', () => {
180
180
it ( 'returns object when response is json' , ( done ) => {
181
181
const mockResponse = {
182
182
results : [ { gender : 'neutral' } ] ,
183
- info : { seed : '0123456789123456' , results : 1 , page : 1 , version : '1.2' }
183
+ info : { seed : '0123456789123456' , results : 1 , page : 1 , version : '1.2' } ,
184
184
}
185
185
fetch . mockResponseOnce ( JSON . stringify ( mockResponse ) , {
186
186
headers : {
187
- 'Content-Type' : 'application/json'
188
- }
187
+ 'Content-Type' : 'application/json' ,
188
+ } ,
189
189
} )
190
190
191
191
request ( )
@@ -213,8 +213,8 @@ describe('request', () => {
213
213
const contentType = 'text/csv; charset=utf-8'
214
214
fetch . mockResponseOnce ( 'csv data' , {
215
215
headers : {
216
- 'Content-Type' : contentType
217
- }
216
+ 'Content-Type' : contentType ,
217
+ } ,
218
218
} )
219
219
220
220
try {
@@ -230,7 +230,7 @@ describe('request', () => {
230
230
it ( 'rejects with error data' , ( done ) => {
231
231
const errorData = {
232
232
error :
233
- 'Uh oh, something has gone wrong. Please tweet us @randomapi about the issue. Thank you.'
233
+ 'Uh oh, something has gone wrong. Please tweet us @randomapi about the issue. Thank you.' ,
234
234
}
235
235
fetch . mockRejectOnce ( JSON . stringify ( errorData ) )
236
236
@@ -267,7 +267,7 @@ describe('request', () => {
267
267
it ( 'rejects with function' , async ( ) => {
268
268
const errorData = {
269
269
error :
270
- 'Uh oh, something has gone wrong. Please tweet us @randomapi about the issue. Thank you.'
270
+ 'Uh oh, something has gone wrong. Please tweet us @randomapi about the issue. Thank you.' ,
271
271
}
272
272
fetch . mockRejectOnce ( ( ) => Promise . reject ( JSON . stringify ( errorData ) ) )
273
273
return expect ( request ( ) ) . rejects . toThrow ( errorData . error )
@@ -276,7 +276,7 @@ describe('request', () => {
276
276
it ( 'rejects with function and timeout' , async ( ) => {
277
277
const errorData = {
278
278
error :
279
- 'Uh oh, something has gone wrong. Please tweet us @randomapi about the issue. Thank you.'
279
+ 'Uh oh, something has gone wrong. Please tweet us @randomapi about the issue. Thank you.' ,
280
280
}
281
281
fetch . mockRejectOnce (
282
282
( ) =>
@@ -312,7 +312,7 @@ describe('request', () => {
312
312
headers : { ding : 'dang' } ,
313
313
status : 201 ,
314
314
statusText : 'text' ,
315
- url : 'http://foo'
315
+ url : 'http://foo' ,
316
316
} ) ,
317
317
{ headers : { bash : 'bang' } }
318
318
)
@@ -328,7 +328,7 @@ describe('request', () => {
328
328
329
329
it ( 'resolves with mock response headers and function returning string' , async ( ) => {
330
330
fetch . mockResponseOnce ( ( ) => Promise . resolve ( 'ok' ) , {
331
- headers : { ding : 'dang' }
331
+ headers : { ding : 'dang' } ,
332
332
} )
333
333
return expect (
334
334
fetch ( 'https://bar' , { } ) . then ( ( response ) => response . headers . get ( 'ding' ) )
@@ -372,10 +372,7 @@ describe('conditional mocking', () => {
372
372
} )
373
373
it ( 'dont mock once then mock twice' , async ( ) => {
374
374
const otherResponse = 'other response'
375
- fetch
376
- . dontMockOnce ( )
377
- . once ( otherResponse )
378
- . once ( otherResponse )
375
+ fetch . dontMockOnce ( ) . once ( otherResponse ) . once ( otherResponse )
379
376
380
377
await expectUnmocked ( )
381
378
await expectMocked ( defaultRequestUri , otherResponse )
0 commit comments