2025-12-12 15:02:56 -08:00
|
|
|
// 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 () => {
|
2026-04-07 23:21:55 -07:00
|
|
|
await prisma.$disconnect().catch(() => undefined);
|
2025-12-12 15:02:56 -08:00
|
|
|
});
|
|
|
|
|
|