Refactor test setup and improve mock implementations
Some checks are pending
Deploy to Test Environment / deploy-to-test (push) Has started running
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:
@@ -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';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user