Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 1x 65x 13x 65x 65x | import { vi } from "vitest";
/**
* Stub every HTTP verb so a smoke-rendered page never reaches the network.
*
* Responses are deliberately *empty but well-formed*: an empty list, a 200,
* no fields. That is the shape a page sees on a fresh account, and it is the
* shape that breaks pages which assume their data is present — which is
* exactly what a smoke test should be finding.
*/
export const axiosStub = {
get: vi.fn(),
post: vi.fn(),
put: vi.fn(),
patch: vi.fn(),
delete: vi.fn(),
};
export const emptyResponse = () => ({
data: [],
status: 200,
statusText: "OK",
headers: {},
config: {},
});
export function resetApiStub(): void {
for (const spy of Object.values(axiosStub)) {
spy.mockReset();
spy.mockResolvedValue(emptyResponse());
}
}
|