refactor: consolidate formatting utilities and add testing infrastructure
- Replace 8 duplicate formatCurrency functions with shared utility - Add comprehensive formatter utilities (currency, date, number, etc.) - Set up Vitest for unit testing with 38 passing tests - Set up Playwright for E2E testing - Consolidate database connection to single source (src/utils/db.ts) - Add auth middleware helpers to reduce code duplication - Fix display bug: remove spurious minus sign in recent activity amounts - Add path aliases for cleaner imports ($utils, $models) - Add project documentation (CODEMAP.md, REFACTORING_PLAN.md) Test coverage: 38 unit tests passing Build: successful with no breaking changes
This commit is contained in:
12
tests/setup.ts
Normal file
12
tests/setup.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
import { vi } from 'vitest';
|
||||
|
||||
// Mock environment variables
|
||||
process.env.MONGO_URL = 'mongodb://localhost:27017/test';
|
||||
process.env.AUTH_SECRET = 'test-secret';
|
||||
process.env.AUTHENTIK_ID = 'test-client-id';
|
||||
process.env.AUTHENTIK_SECRET = 'test-client-secret';
|
||||
process.env.AUTHENTIK_ISSUER = 'https://test.authentik.example.com';
|
||||
|
||||
// Mock SvelteKit specific globals
|
||||
global.fetch = vi.fn();
|
||||
Reference in New Issue
Block a user