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:
91
tests/README.md
Normal file
91
tests/README.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# Testing Documentation
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
**Status**: Test Framework Setup
|
||||
|
||||
## Test Structure
|
||||
|
||||
```
|
||||
tests/
|
||||
├── integration/ # Integration tests
|
||||
│ ├── setup.ts # Test context setup
|
||||
│ ├── identity-credential-flow.test.ts
|
||||
│ └── document-workflow.test.ts
|
||||
└── e2e/ # End-to-end tests
|
||||
└── user-workflows.test.ts
|
||||
```
|
||||
|
||||
## Running Tests
|
||||
|
||||
### All Tests
|
||||
```bash
|
||||
pnpm test
|
||||
```
|
||||
|
||||
### Unit Tests Only
|
||||
```bash
|
||||
pnpm test -- --run unit
|
||||
```
|
||||
|
||||
### Integration Tests
|
||||
```bash
|
||||
pnpm test -- --run integration
|
||||
```
|
||||
|
||||
### E2E Tests
|
||||
```bash
|
||||
pnpm test -- --run e2e
|
||||
```
|
||||
|
||||
### With Coverage
|
||||
```bash
|
||||
pnpm test -- --coverage
|
||||
```
|
||||
|
||||
## Test Coverage Goals
|
||||
|
||||
- **Target**: 80%+ coverage across all services
|
||||
- **Current**: Expanding coverage
|
||||
- **Priority**: Critical service paths first
|
||||
|
||||
## Test Types
|
||||
|
||||
### Unit Tests
|
||||
- Service-specific tests in `services/*/tests/`
|
||||
- Test individual functions and modules
|
||||
- Mock external dependencies
|
||||
|
||||
### Integration Tests
|
||||
- Test service interactions
|
||||
- Use test database
|
||||
- Test API endpoints
|
||||
|
||||
### E2E Tests
|
||||
- Test complete user workflows
|
||||
- Test across multiple services
|
||||
- Test real-world scenarios
|
||||
|
||||
## Test Utilities
|
||||
|
||||
### Test Context
|
||||
- `setupTestContext()` - Initialize all services
|
||||
- `teardownTestContext()` - Clean up services
|
||||
- `cleanupDatabase()` - Clean test data
|
||||
|
||||
### Fixtures
|
||||
- Test data factories
|
||||
- Mock services
|
||||
- Test helpers
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Isolation**: Each test should be independent
|
||||
2. **Cleanup**: Always clean up test data
|
||||
3. **Mocking**: Mock external services
|
||||
4. **Coverage**: Aim for 80%+ coverage
|
||||
5. **Speed**: Keep tests fast
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
Reference in New Issue
Block a user