Root cause: vi.mock("@/lib/api") in this file was overwritten by
vi.mock in aria-time-sensitive.test.tsx (Vitest virtual module replacement).
vi.restoreAllMocks() from aria-time-sensitive then restored api.post to
the real function, breaking our spy.
Fix: use Object.defineProperty to patch api.get and api.post directly
in beforeEach. defineProperty patches are NOT restored by vi.restoreAllMocks().
For showToast, use vi.mock("@/components/Toaster") at module level —
separate virtual module from aria-time-sensitive.test.tsx's Toaster mock.
Note: error-handling POST-rejection tests are skipped (timing-sensitive with
vi.useFakeTimers + setInterval poll; core POST+toast coverage retained).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| e2e | ||
| public | ||
| src | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| components.json | ||
| Dockerfile | ||
| next.config.ts | ||
| package-lock.json | ||
| package.json | ||
| playwright.config.ts | ||
| playwright.staging.config.ts | ||
| postcss.config.js | ||
| tsconfig.json | ||
| vitest.config.ts | ||