- Add jest.setup.js with JWT_SECRET for test environment - Update jest.config.js with setupFiles and increased timeout - Fix auth middleware to return 401 (not 403) for invalid JWT tokens - Fix errorHandler to return 'message' instead of 'error' in response - Fix validate middleware to properly detect Zod errors in ESM - Remove unused 'pool' import in middleware tests (lint fix) - Update middleware tests to check next() calls with AppError 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
14 lines
365 B
JavaScript
14 lines
365 B
JavaScript
/**
|
|
* Jest setup file - configure test environment
|
|
*/
|
|
|
|
// Set test environment variables
|
|
process.env.NODE_ENV = 'test';
|
|
process.env.JWT_SECRET = 'test-jwt-secret-key-for-testing-purposes-only';
|
|
process.env.JWT_EXPIRES_IN = '1h';
|
|
process.env.PORT = '3001';
|
|
|
|
// Disable console logs during tests (optional)
|
|
// console.log = jest.fn();
|
|
// console.error = jest.fn();
|