// Jest setup for database tests const { execSync } = require('child_process'); // Set test environment variables process.env.DATABASE_URL = process.env.DATABASE_URL || 'postgresql://cloneweb_user:cloneweb_password@localhost:5432/cloneweb_test'; process.env.NODE_ENV = 'test'; // Global setup - run before all tests beforeAll(async () => { // Ensure test database exists and is migrated try { execSync('npx prisma db push --force-reset', { stdio: 'inherit' }); } catch (error) { console.warn('Database setup failed, tests may fail:', error.message); } }); // Global teardown - run after all tests afterAll(async () => { // Clean up test database if needed // Note: In a real environment, you might want to clean up test data });