Skip to content

Commit 69ecd87

Browse files
committed
test: use Response.json() in mock
1 parent 52679c0 commit 69ecd87

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

test/nuxt/pages/PackageVersionsPage.spec.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ function mockFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Respon
4646
const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url
4747
if (url.includes('npm.antfu.dev/versions/')) {
4848
const body = nextFetchResponse ?? { distTags: {}, versions: [], time: {} }
49-
return Promise.resolve(
50-
new Response(JSON.stringify(body), {
51-
status: 200,
52-
headers: { 'Content-Type': 'application/json' },
53-
}),
54-
)
49+
return Promise.resolve(Response.json(body))
5550
}
5651
return originalFetch(input, init)
5752
}

0 commit comments

Comments
 (0)