Initial commit
This commit is contained in:
22
src/__tests__/setup.ts
Normal file
22
src/__tests__/setup.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
// Jest test setup
|
||||
// Runs before all tests
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
|
||||
// Set test environment
|
||||
process.env.NODE_ENV = 'test';
|
||||
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || 'postgresql://test:test@localhost:5432/dbis_test';
|
||||
process.env.JWT_SECRET = 'test-jwt-secret-minimum-32-characters-long-for-testing';
|
||||
process.env.ALLOWED_ORIGINS = 'http://localhost:3000';
|
||||
process.env.LOG_LEVEL = 'error'; // Reduce log noise in tests
|
||||
|
||||
// Global test timeout
|
||||
jest.setTimeout(10000);
|
||||
|
||||
// Cleanup after all tests
|
||||
afterAll(async () => {
|
||||
// Close any open connections
|
||||
const prisma = new PrismaClient();
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user