feat: expand test coverage and configure comprehensive alerting

- Add unit tests for all core services (identity, intake, finance, dataroom)
- Create integration test framework with shared setup utilities
- Add E2E test suite for complete user workflows
- Add test utilities package (server factory)
- Configure Prometheus alert rules (service health, infrastructure, database, Azure)
- Add alert rules ConfigMap for Kubernetes
- Update Prometheus deployment with alert rules
- Fix tsconfig.json to include test files
- Add tests/tsconfig.json for integration/E2E tests
- Fix server-factory.ts linting issues
This commit is contained in:
defiQUG
2025-11-13 10:04:32 -08:00
parent dea584aa2c
commit 3d43155312
20 changed files with 822 additions and 35 deletions

View File

@@ -0,0 +1,44 @@
/**
* Server Factory for Testing
* Creates Fastify server instances for testing
*/
import { FastifyInstance } from 'fastify';
import Fastify from 'fastify';
import { getEnv } from '@the-order/shared';
export interface ServerFactoryOptions {
port?: number;
logger?: boolean;
[key: string]: unknown;
}
export async function createTestServer(
routes: (server: FastifyInstance) => Promise<void>,
options: ServerFactoryOptions = {}
): Promise<FastifyInstance> {
const server = Fastify({
logger: options.logger ?? false,
requestIdLogLabel: 'requestId',
disableRequestLogging: !options.logger,
});
// Register routes
await routes(server);
// Health check
server.get('/health', () => {
return { status: 'ok' };
});
if (options.port) {
await server.listen({ port: options.port, host: '0.0.0.0' });
}
return server;
}
export function closeTestServer(server: FastifyInstance): Promise<void> {
return server.close();
}