MCPcopy
hub / github.com/npmx-dev/npmx.dev / mockFetchError

Function mockFetchError

test/unit/server/utils/file-tree.spec.ts:16–23  ·  view source on GitHub ↗
(status: number)

Source from the content-addressed store, hash-verified

14}
15
16const mockFetchError = (status: number) => {
17 const fetchMock = vi.fn().mockResolvedValue({
18 ok: false,
19 status,
20 })
21 vi.stubGlobal('fetch', fetchMock)
22 return fetchMock
23}
24
25const mockCreateError = () => {
26 const createErrorMock = vi.fn((opts: { statusCode: number; message: string }) => opts)

Callers 1

file-tree.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected