Add user database service and unit tests
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m28s

- Implement user database service with functions for user management (create, find, update, delete).
- Add comprehensive unit tests for user database service using Vitest.
- Mock database interactions to ensure isolated testing.
- Create setup files for unit tests to handle database connections and global mocks.
- Introduce error handling for unique constraints and foreign key violations.
- Enhance logging for better traceability during database operations.
This commit is contained in:
2025-12-04 15:30:27 -08:00
parent 4cf587c8f0
commit 80d2b1ffe6
62 changed files with 135 additions and 136 deletions

View File

@@ -1,5 +1,4 @@
// vite.config.ts
/// <reference types="vitest" />
import path from 'path';
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
@@ -40,7 +39,7 @@ export default defineConfig({
fileParallelism: false,
environment: 'jsdom',
globalSetup: './src/tests/setup/global-setup.ts',
setupFiles: ['./src/tests/setup/unit-setup.ts'],
setupFiles: ['./src/tests/setup/tests-setup-unit.ts'],
// Explicitly include all test files that are NOT integration tests.
include: ['src/**/*.test.{ts,tsx}'],
// Exclude integration tests and other non-test files from the unit test runner.