@@ -42,12 +42,16 @@ describe('static.publicPath option', () => {
42
42
} ) ;
43
43
} ) ;
44
44
45
- it ( 'Request to index' , ( done ) => {
46
- req . get ( `${ staticPublicPath } /` ) . expect ( 200 , / H e y o / , done ) ;
45
+ it ( 'Request to index' , async ( ) => {
46
+ const { status, text } = await req . get ( `${ staticPublicPath } /` ) ;
47
+ expect ( status ) . toEqual ( 200 ) ;
48
+ expect ( text ) . toContain ( 'Heyo' ) ;
47
49
} ) ;
48
50
49
- it ( 'Request to other file' , ( done ) => {
50
- req . get ( `${ staticPublicPath } /other.html` ) . expect ( 200 , / O t h e r h t m l / , done ) ;
51
+ it ( 'Request to other file' , async ( ) => {
52
+ const { status, text } = await req . get ( `${ staticPublicPath } /other.html` ) ;
53
+ expect ( status ) . toEqual ( 200 ) ;
54
+ expect ( text ) . toContain ( 'Other html' ) ;
51
55
} ) ;
52
56
} ) ;
53
57
@@ -75,12 +79,15 @@ describe('static.publicPath option', () => {
75
79
} ) ;
76
80
} ) ;
77
81
78
- it ( "shouldn't list the files inside the assets folder (404)" , ( done ) => {
79
- req . get ( `${ staticPublicPath } /assets/` ) . expect ( 404 , done ) ;
82
+ it ( "shouldn't list the files inside the assets folder (404)" , async ( ) => {
83
+ const { status } = await req . get ( `${ staticPublicPath } /assets/` ) ;
84
+ expect ( status ) . toEqual ( 404 ) ;
80
85
} ) ;
81
86
82
- it ( 'should show Heyo. because bar has index.html inside it (200)' , ( done ) => {
83
- req . get ( `${ staticPublicPath } /bar/` ) . expect ( 200 , / H e y o / , done ) ;
87
+ it ( 'should show Heyo. because bar has index.html inside it (200)' , async ( ) => {
88
+ const { status, text } = await req . get ( `${ staticPublicPath } /bar/` ) ;
89
+ expect ( status ) . toEqual ( 200 ) ;
90
+ expect ( text ) . toContain ( 'Heyo' ) ;
84
91
} ) ;
85
92
} ) ;
86
93
@@ -108,12 +115,15 @@ describe('static.publicPath option', () => {
108
115
} ) ;
109
116
} ) ;
110
117
111
- it ( 'should list the files inside the assets folder (200)' , ( done ) => {
112
- req . get ( `${ staticPublicPath } /assets/` ) . expect ( 200 , done ) ;
118
+ it ( 'should list the files inside the assets folder (200)' , async ( ) => {
119
+ const { status } = await req . get ( `${ staticPublicPath } /assets/` ) ;
120
+ expect ( status ) . toEqual ( 200 ) ;
113
121
} ) ;
114
122
115
- it ( 'should show Heyo. because bar has index.html inside it (200)' , ( done ) => {
116
- req . get ( `${ staticPublicPath } /bar/` ) . expect ( 200 , / H e y o / , done ) ;
123
+ it ( 'should show Heyo. because bar has index.html inside it (200)' , async ( ) => {
124
+ const { status, text } = await req . get ( `${ staticPublicPath } /bar/` ) ;
125
+ expect ( status ) . toEqual ( 200 ) ;
126
+ expect ( text ) . toContain ( 'Heyo' ) ;
117
127
} ) ;
118
128
} ) ;
119
129
@@ -140,12 +150,15 @@ describe('static.publicPath option', () => {
140
150
} ) ;
141
151
} ) ;
142
152
143
- it ( 'should list the files inside the assets folder (200)' , ( done ) => {
144
- req . get ( `${ staticPublicPath } /assets/` ) . expect ( 200 , done ) ;
153
+ it ( 'should list the files inside the assets folder (200)' , async ( ) => {
154
+ const { status } = await req . get ( `${ staticPublicPath } /assets/` ) ;
155
+ expect ( status ) . toEqual ( 200 ) ;
145
156
} ) ;
146
157
147
- it ( 'should show Heyo. because bar has index.html inside it (200)' , ( done ) => {
148
- req . get ( `${ staticPublicPath } /bar/` ) . expect ( 200 , / H e y o / , done ) ;
158
+ it ( 'should show Heyo. because bar has index.html inside it (200)' , async ( ) => {
159
+ const { status, text } = await req . get ( `${ staticPublicPath } /bar/` ) ;
160
+ expect ( status ) . toEqual ( 200 ) ;
161
+ expect ( text ) . toContain ( 'Heyo' ) ;
149
162
} ) ;
150
163
} ) ;
151
164
@@ -177,12 +190,16 @@ describe('static.publicPath option', () => {
177
190
} ) ;
178
191
} ) ;
179
192
180
- it ( 'Request to first directory' , ( done ) => {
181
- req . get ( `${ staticPublicPath } /` ) . expect ( 200 , / H e y o / , done ) ;
193
+ it ( 'Request to first directory' , async ( ) => {
194
+ const { status, text } = await req . get ( `${ staticPublicPath } /` ) ;
195
+ expect ( status ) . toEqual ( 200 ) ;
196
+ expect ( text ) . toContain ( 'Heyo' ) ;
182
197
} ) ;
183
198
184
- it ( 'Request to second directory' , ( done ) => {
185
- req . get ( `${ staticPublicPath } /foo.html` ) . expect ( 200 , / F o o ! / , done ) ;
199
+ it ( 'Request to second directory' , async ( ) => {
200
+ const { status, text } = await req . get ( `${ staticPublicPath } /foo.html` ) ;
201
+ expect ( status ) . toEqual ( 200 ) ;
202
+ expect ( text ) . toContain ( 'Foo!' ) ;
186
203
} ) ;
187
204
} ) ;
188
205
@@ -209,8 +226,9 @@ describe('static.publicPath option', () => {
209
226
} ) ;
210
227
} ) ;
211
228
212
- it ( 'Request to page' , ( done ) => {
213
- req . get ( `${ staticPublicPath } /index.html` ) . expect ( 200 , done ) ;
229
+ it ( 'Request to page' , async ( ) => {
230
+ const { status } = await req . get ( `${ staticPublicPath } /index.html` ) ;
231
+ expect ( status ) . toEqual ( 200 ) ;
214
232
} ) ;
215
233
} ) ;
216
234
@@ -264,28 +282,34 @@ describe('static.publicPath option', () => {
264
282
testServer . close ( done ) ;
265
283
} ) ;
266
284
267
- it ( 'GET request' , ( done ) => {
268
- req . get ( `${ staticPublicPath } /` ) . expect ( 200 , done ) ;
285
+ it ( 'GET request' , async ( ) => {
286
+ const { status } = await req . get ( `${ staticPublicPath } /` ) ;
287
+ expect ( status ) . toEqual ( 200 ) ;
269
288
} ) ;
270
289
271
- it ( 'HEAD request' , ( done ) => {
272
- req . head ( `${ staticPublicPath } /` ) . expect ( 200 , done ) ;
290
+ it ( 'HEAD request' , async ( ) => {
291
+ const { status } = await req . head ( `${ staticPublicPath } /` ) ;
292
+ expect ( status ) . toEqual ( 200 ) ;
273
293
} ) ;
274
294
275
- it ( 'POST request' , ( done ) => {
276
- req . post ( `${ staticPublicPath } /` ) . expect ( 404 , done ) ;
295
+ it ( 'POST request' , async ( ) => {
296
+ const { status } = await req . post ( `${ staticPublicPath } /` ) ;
297
+ expect ( status ) . toEqual ( 404 ) ;
277
298
} ) ;
278
299
279
- it ( 'PUT request' , ( done ) => {
280
- req . put ( `${ staticPublicPath } /` ) . expect ( 404 , done ) ;
300
+ it ( 'PUT request' , async ( ) => {
301
+ const { status } = await req . put ( `${ staticPublicPath } /` ) ;
302
+ expect ( status ) . toEqual ( 404 ) ;
281
303
} ) ;
282
304
283
- it ( 'DELETE request' , ( done ) => {
284
- req . delete ( `${ staticPublicPath } /` ) . expect ( 404 , done ) ;
305
+ it ( 'DELETE request' , async ( ) => {
306
+ const { status } = await req . delete ( `${ staticPublicPath } /` ) ;
307
+ expect ( status ) . toEqual ( 404 ) ;
285
308
} ) ;
286
309
287
- it ( 'PATCH request' , ( done ) => {
288
- req . patch ( `${ staticPublicPath } /` ) . expect ( 404 , done ) ;
310
+ it ( 'PATCH request' , async ( ) => {
311
+ const { status } = await req . patch ( `${ staticPublicPath } /` ) ;
312
+ expect ( status ) . toEqual ( 404 ) ;
289
313
} ) ;
290
314
} ) ;
291
315
@@ -319,16 +343,24 @@ describe('static.publicPath option', () => {
319
343
} ) ;
320
344
} ) ;
321
345
322
- it ( 'Request the first path to index' , ( done ) => {
323
- req . get ( `${ staticPublicPath } /` ) . expect ( 200 , / H e y o / , done ) ;
346
+ it ( 'Request the first path to index' , async ( ) => {
347
+ const { status, text } = await req . get ( `${ staticPublicPath } /` ) ;
348
+ expect ( status ) . toEqual ( 200 ) ;
349
+ expect ( text ) . toContain ( 'Heyo' ) ;
324
350
} ) ;
325
351
326
- it ( 'Request the first path to other file' , ( done ) => {
327
- req . get ( `${ staticPublicPath } /other.html` ) . expect ( 200 , / O t h e r h t m l / , done ) ;
352
+ it ( 'Request the first path to other file' , async ( ) => {
353
+ const { status, text } = await req . get ( `${ staticPublicPath } /other.html` ) ;
354
+ expect ( status ) . toEqual ( 200 ) ;
355
+ expect ( text ) . toContain ( 'Other html' ) ;
328
356
} ) ;
329
357
330
- it ( 'Request the second path to foo' , ( done ) => {
331
- req . get ( `${ otherStaticPublicPath } /foo.html` ) . expect ( 200 , / F o o ! / , done ) ;
358
+ it ( 'Request the second path to foo' , async ( ) => {
359
+ const { status, text } = await req . get (
360
+ `${ otherStaticPublicPath } /foo.html`
361
+ ) ;
362
+ expect ( status ) . toEqual ( 200 ) ;
363
+ expect ( text ) . toContain ( 'Foo!' ) ;
332
364
} ) ;
333
365
} ) ;
334
366
@@ -362,20 +394,28 @@ describe('static.publicPath option', () => {
362
394
} ) ;
363
395
} ) ;
364
396
365
- it ( 'Request the first path to index' , ( done ) => {
366
- req . get ( `${ staticPublicPath } /` ) . expect ( 200 , / H e y o / , done ) ;
397
+ it ( 'Request the first path to index' , async ( ) => {
398
+ const { status, text } = await req . get ( `${ staticPublicPath } /` ) ;
399
+ expect ( status ) . toEqual ( 200 ) ;
400
+ expect ( text ) . toContain ( 'Heyo' ) ;
367
401
} ) ;
368
402
369
- it ( 'Request the first path to other file' , ( done ) => {
370
- req . get ( `${ staticPublicPath } /other.html` ) . expect ( 200 , / O t h e r h t m l / , done ) ;
403
+ it ( 'Request the first path to other file' , async ( ) => {
404
+ const { status, text } = await req . get ( `${ staticPublicPath } /other.html` ) ;
405
+ expect ( status ) . toEqual ( 200 ) ;
406
+ expect ( text ) . toContain ( 'Other html' ) ;
371
407
} ) ;
372
408
373
- it ( 'Request the first path to foo' , ( done ) => {
374
- req . get ( `${ staticPublicPath } /foo.html` ) . expect ( 200 , / F o o ! / , done ) ;
409
+ it ( 'Request the first path to foo' , async ( ) => {
410
+ const { status, text } = await req . get ( `${ staticPublicPath } /foo.html` ) ;
411
+ expect ( status ) . toEqual ( 200 ) ;
412
+ expect ( text ) . toContain ( 'Foo!' ) ;
375
413
} ) ;
376
414
377
- it ( 'Request the second path to foo' , ( done ) => {
378
- req . get ( `${ otherStaticPublicPath } /foo.html` ) . expect ( 200 , / F o o ! / , done ) ;
415
+ it ( 'Request the second path to foo' , async ( ) => {
416
+ const { status, text } = await req . get ( `${ staticPublicPath } /foo.html` ) ;
417
+ expect ( status ) . toEqual ( 200 ) ;
418
+ expect ( text ) . toContain ( 'Foo!' ) ;
379
419
} ) ;
380
420
} ) ;
381
421
} ) ;
0 commit comments