Skip to content

Commit d69ccd3

Browse files
committed
chore: update
1 parent d46b860 commit d69ccd3

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

test/unit/server/utils/file-tree.spec.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@ import {
99
const getChildren = (node?: PackageFileTree): PackageFileTree[] => node?.children ?? []
1010

1111
const mockFetchOk = <T>(body: T) => {
12-
const fetchMock = vi.fn().mockResolvedValue({
13-
ok: true,
14-
json: async () => body,
15-
})
16-
vi.stubGlobal('fetch', fetchMock)
12+
const fetchMock = vi.fn().mockResolvedValue(body)
13+
vi.stubGlobal('$fetch', fetchMock)
1714
return fetchMock
1815
}
1916

2017
const mockFetchError = (status: number) => {
21-
const fetchMock = vi.fn().mockResolvedValue({
22-
ok: false,
23-
status,
24-
})
25-
vi.stubGlobal('fetch', fetchMock)
18+
const fetchMock = vi.fn().mockRejectedValue({ response: { status } })
19+
vi.stubGlobal('$fetch', fetchMock)
2620
return fetchMock
2721
}
2822

0 commit comments

Comments
 (0)