Restore codebase deleted by bad auto-commit e4227cf
Commit e4227cf (a story creation auto-commit) erroneously deleted 175
files from master's tree, likely due to a race condition between
concurrent git operations. This commit re-adds all files from the
working directory.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
20
frontend/src/setupTests.ts
Normal file
20
frontend/src/setupTests.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import "@testing-library/jest-dom";
|
||||
import { beforeEach, vi } from "vitest";
|
||||
|
||||
// Provide a default fetch mock so components that call API endpoints on mount
|
||||
// don't throw URL-parse errors in the jsdom test environment. Tests that need
|
||||
// specific responses should mock the relevant `api.*` method as usual.
|
||||
beforeEach(() => {
|
||||
vi.stubGlobal(
|
||||
"fetch",
|
||||
vi.fn((input: string | URL | Request) => {
|
||||
const url = typeof input === "string" ? input : input.toString();
|
||||
// Endpoints that return arrays need [] not {} to avoid "not iterable" errors.
|
||||
const arrayEndpoints = ["/agents", "/agents/config"];
|
||||
const body = arrayEndpoints.some((ep) => url.endsWith(ep))
|
||||
? JSON.stringify([])
|
||||
: JSON.stringify({});
|
||||
return Promise.resolve(new Response(body, { status: 200 }));
|
||||
}),
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user