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:
63
tests/integration/identity-credential-flow.test.ts
Normal file
63
tests/integration/identity-credential-flow.test.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Integration Test: Identity Credential Flow
|
||||
* Tests the complete flow of credential issuance and verification
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
||||
import { setupTestContext, teardownTestContext, cleanupDatabase, TestContext } from './setup';
|
||||
|
||||
describe('Identity Credential Flow - Integration', () => {
|
||||
let context: TestContext;
|
||||
|
||||
beforeAll(async () => {
|
||||
context = await setupTestContext();
|
||||
await cleanupDatabase(context.dbPool);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanupDatabase(context.dbPool);
|
||||
await teardownTestContext(context);
|
||||
});
|
||||
|
||||
describe('Credential Issuance Flow', () => {
|
||||
it('should issue a verifiable credential end-to-end', async () => {
|
||||
// 1. Create identity
|
||||
const identityResponse = await context.identityService.inject({
|
||||
method: 'POST',
|
||||
url: '/api/v1/identities',
|
||||
payload: {
|
||||
did: 'did:example:123',
|
||||
eidasLevel: 'substantial',
|
||||
},
|
||||
});
|
||||
|
||||
expect(identityResponse.statusCode).toBe(201);
|
||||
const identity = identityResponse.json();
|
||||
|
||||
// 2. Issue credential
|
||||
const credentialResponse = await context.identityService.inject({
|
||||
method: 'POST',
|
||||
url: '/api/v1/credentials/issue',
|
||||
payload: {
|
||||
identityId: identity.id,
|
||||
credentialType: 'membership',
|
||||
claims: {
|
||||
name: 'Test User',
|
||||
membershipNumber: '12345',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(credentialResponse.statusCode).toBe(201);
|
||||
const credential = credentialResponse.json();
|
||||
expect(credential).toHaveProperty('id');
|
||||
expect(credential).toHaveProperty('credentialType', 'membership');
|
||||
});
|
||||
|
||||
it('should verify a credential', async () => {
|
||||
// This would test credential verification
|
||||
// Implementation depends on verifier-sdk
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user