Files
ReadMeABook/tests/setup.ts
T
kikootwo 94dbaf073b Add backend unit test framework and modularize settings UI
Introduced a Vitest-based backend unit testing framework with supporting scripts, helpers, and GitHub Actions integration. Refactored the admin settings page to a modular architecture, splitting monolithic logic into feature-specific tabs and hooks for improved maintainability and testability. Updated documentation to reflect the new testing setup and settings architecture, and added new dependencies for testing utilities.
2026-01-28 11:41:59 -05:00

24 lines
503 B
TypeScript

/**
* Component: Test Setup
* Documentation: documentation/README.md
*/
import { beforeAll, afterAll, vi } from 'vitest';
import '@testing-library/jest-dom';
beforeAll(() => {
process.env.NODE_ENV = 'test';
process.env.TZ = 'UTC';
if (!globalThis.fetch) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(globalThis as any).fetch = () => {
throw new Error('fetch was called without a mock in tests');
};
}
});
afterAll(() => {
vi.restoreAllMocks();
});