mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 21:00:09 +00:00
94dbaf073b
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.
24 lines
503 B
TypeScript
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();
|
|
});
|