23 lines
662 B
TypeScript
23 lines
662 B
TypeScript
|
|
// 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();
|
||
|
|
});
|
||
|
|
|