@@ -137,18 +137,18 @@ describe('load', async () => {
137
137
} )
138
138
139
139
it ( 'loads url' , async ( ) => {
140
- // @ts -expect-error only partially patched
141
- global . fetch = async ( ) => ( {
142
- text : async ( ) =>
143
- stringify ( {
144
- openapi : '3.1.0' ,
145
- info : {
146
- title : 'Hello World' ,
147
- version : '1.0.0' ,
148
- } ,
149
- paths : { } ,
150
- } ) ,
151
- } )
140
+ global . fetch = async ( ) =>
141
+ ( {
142
+ text : async ( ) =>
143
+ stringify ( {
144
+ openapi : '3.1.0' ,
145
+ info : {
146
+ title : 'Hello World' ,
147
+ version : '1.0.0' ,
148
+ } ,
149
+ paths : { } ,
150
+ } ) ,
151
+ } ) as Response
152
152
153
153
const { filesystem } = await load ( 'https://example.com/openapi.yaml' , {
154
154
plugins : [ readFilesPlugin ( ) , fetchUrlsPlugin ( ) ] ,
@@ -209,12 +209,10 @@ describe('load', async () => {
209
209
} )
210
210
211
211
it ( 'limits the number of requests' , async ( ) => {
212
- // @ts -expect-error only partially patched
213
- global . fetch = async ( ) => {
214
- return {
212
+ global . fetch = async ( ) =>
213
+ ( {
215
214
text : async ( ) => 'FOOBAR' ,
216
- }
217
- }
215
+ } ) as unknown as Response
218
216
219
217
const { filesystem } = await load (
220
218
{
@@ -252,7 +250,6 @@ describe('load', async () => {
252
250
} )
253
251
254
252
it ( 'loads referenced urls' , async ( ) => {
255
- // @ts -expect-error only partially patched
256
253
global . fetch = async ( url : string ) => {
257
254
if ( url === 'https://example.com/openapi.yaml' ) {
258
255
return {
@@ -273,7 +270,7 @@ describe('load', async () => {
273
270
} ,
274
271
} ,
275
272
} ) ,
276
- }
273
+ } as Response
277
274
}
278
275
279
276
if ( url === 'https://example.com/foobar.json' ) {
@@ -289,7 +286,7 @@ describe('load', async () => {
289
286
} ,
290
287
} ,
291
288
} ) ,
292
- }
289
+ } as Response
293
290
}
294
291
}
295
292
@@ -327,8 +324,7 @@ describe('load', async () => {
327
324
} )
328
325
329
326
it ( 'loads string with url reference' , async ( ) => {
330
- // @ts -expect-error only partially patched
331
- global . fetch = async ( url : string ) => {
327
+ global . fetch = async ( ) => {
332
328
return {
333
329
text : async ( ) =>
334
330
JSON . stringify ( {
@@ -341,7 +337,7 @@ describe('load', async () => {
341
337
} ,
342
338
} ,
343
339
} ) ,
344
- }
340
+ } as Response
345
341
}
346
342
347
343
const { filesystem } = await load (
0 commit comments