Refactor test setup and improve mock implementations
Some checks are pending
Deploy to Test Environment / deploy-to-test (push) Has started running

- Introduced `createTestApp` utility to standardize Express app creation for tests, including JSON parsing, mock logger, and error handling.
- Updated all route tests to utilize `createTestApp`, enhancing consistency and reducing boilerplate code.
- Implemented `mockLogger` for cleaner test output and easier logging mock management.
- Adjusted passport mocks to ensure proper user authentication simulation across tests.
- Enhanced type safety by augmenting Express Request interface with `req.log` and `req.user` properties.
- Removed redundant code and improved readability in various test files.
This commit is contained in:
2025-12-14 14:47:19 -08:00
parent edb0f8a38c
commit eb0e183f61
31 changed files with 244 additions and 419 deletions

View File

@@ -1,7 +1,7 @@
// src/routes/admin.routes.ts
import { Router, NextFunction, Request, Response } from 'express';
import passport from './passport.routes';
import { isAdmin, optionalAuth } from './passport.routes'; // Correctly imported
import { isAdmin } from './passport.routes'; // Correctly imported
import multer from 'multer';// --- Zod Schemas for Admin Routes (as per ADR-003) ---
import { z } from 'zod';