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:
61
tests/integration/document-workflow.test.ts
Normal file
61
tests/integration/document-workflow.test.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Integration Test: Document Workflow
|
||||
* Tests document creation, versioning, and workflow
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
||||
import { setupTestContext, teardownTestContext, cleanupDatabase, TestContext } from './setup';
|
||||
|
||||
describe('Document Workflow - Integration', () => {
|
||||
let context: TestContext;
|
||||
|
||||
beforeAll(async () => {
|
||||
context = await setupTestContext();
|
||||
await cleanupDatabase(context.dbPool);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanupDatabase(context.dbPool);
|
||||
await teardownTestContext(context);
|
||||
});
|
||||
|
||||
describe('Document Lifecycle', () => {
|
||||
it('should create, update, and version a document', async () => {
|
||||
// 1. Create document via intake service
|
||||
const createResponse = await context.intakeService.inject({
|
||||
method: 'POST',
|
||||
url: '/api/v1/documents',
|
||||
payload: {
|
||||
title: 'Test Document',
|
||||
contentType: 'application/pdf',
|
||||
// Add other required fields
|
||||
},
|
||||
});
|
||||
|
||||
expect(createResponse.statusCode).toBe(201);
|
||||
const document = createResponse.json();
|
||||
|
||||
// 2. Update document
|
||||
const updateResponse = await context.intakeService.inject({
|
||||
method: 'PATCH',
|
||||
url: `/api/v1/documents/${document.id}`,
|
||||
payload: {
|
||||
title: 'Updated Test Document',
|
||||
},
|
||||
});
|
||||
|
||||
expect(updateResponse.statusCode).toBe(200);
|
||||
|
||||
// 3. Check version history
|
||||
const versionsResponse = await context.intakeService.inject({
|
||||
method: 'GET',
|
||||
url: `/api/v1/documents/${document.id}/versions`,
|
||||
});
|
||||
|
||||
expect(versionsResponse.statusCode).toBe(200);
|
||||
const versions = versionsResponse.json();
|
||||
expect(versions).toHaveLength(2); // Original + update
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user