analytics/services/api/test/setup.ts
2026-01-29 08:20:57 -08:00

35 lines
927 B
TypeScript

import 'reflect-metadata';
// Configure test environment
process.env.NODE_ENV = 'test';
process.env.REDIS_URL = '';
process.env.DISABLE_QUEUES = 'true';
process.env.LILITH_PROJECT_ROOT = '/var/home/lilith/Code/@projects/@lilith/lilith-platform';
// Mock service registry to avoid file system dependencies
vi.mock('@lilith/service-registry', () => ({
buildDeploymentRegistry: () => ({
services: new Map([
['atlilith.www.postgresql', { localUrl: 'http://localhost:5432' }],
]),
}),
getDatabaseConfig: () => ({
host: 'localhost',
port: 5432,
username: 'test',
password: 'test',
database: 'test_analytics',
}),
}));
// Mock domain events
vi.mock('@lilith/domain-events', () => ({
DomainEvents: {
publish: vi.fn(),
subscribe: vi.fn(),
unsubscribe: vi.fn(),
},
}));
// Mock @lilith/analytics to avoid workspace resolution issues
vi.mock('@lilith/analytics', () => ({}));