mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 11:12:11 +01:00
- Replace SQLite with PostgreSQL using Neon as provider - Add environment-based database URL configuration - Create separate test database setup with DATABASE_URL_TEST - Reset migration history and generate fresh PostgreSQL schema - Add comprehensive migration documentation - Include database unit tests for connection validation
25 lines
586 B
TypeScript
25 lines
586 B
TypeScript
// Vitest test setup
|
|
import { vi } from 'vitest';
|
|
|
|
// Mock console methods to reduce noise in tests
|
|
global.console = {
|
|
...console,
|
|
log: vi.fn(),
|
|
warn: vi.fn(),
|
|
error: vi.fn(),
|
|
};
|
|
|
|
// Set test environment variables
|
|
process.env.NEXTAUTH_SECRET = 'test-secret';
|
|
process.env.NEXTAUTH_URL = 'http://localhost:3000';
|
|
|
|
// Use test database for all database operations during tests
|
|
if (process.env.DATABASE_URL_TEST) {
|
|
process.env.DATABASE_URL = process.env.DATABASE_URL_TEST;
|
|
}
|
|
|
|
// Mock node-fetch for transcript fetcher tests
|
|
vi.mock('node-fetch', () => ({
|
|
default: vi.fn(),
|
|
}));
|