Provider Directory Service — Testing Strategy
Status: populated
Owner: TBD
Last updated: 2026-04-17
1. Coverage Targets
| Layer | Target |
|---|
| Domain | ≥ 95% |
| Application | ≥ 90% |
| Infrastructure | ≥ 80% |
| Presentation | ≥ 80% |
| Overall | ≥ 80% line / ≥ 70% branch |
2. Unit tests
| Area | Key cases |
|---|
| Practitioner aggregate | Official name required; identifier uniqueness per authority |
| Credential | Expiry state transitions; revoke blocks active roles that depend on it |
| Role | Privilege gating (BR-PROV-001); deactivation side-effects |
| HealthcareService | Specialty code validation |
| ServiceEndpoint | Auth-method matrix; health-state transitions |
3. Integration tests
Mandatory platform three:
| Spec | Purpose |
|---|
tenant-isolation.spec.ts | RLS |
outbox.spec.ts | Outbox → NATS |
inbox.spec.ts | Dedup on identity.user.registered.v1 |
Service-specific:
| Spec | Purpose |
|---|
credential-expiry-job.integration.spec.ts | Scheduled scan → events |
privilege-cascade.integration.spec.ts | Revoke credential → roles auto-demoted |
search-multi-script.integration.spec.ts | "Ahmad" ↔ "احمد" results |
endpoint-healthcheck.integration.spec.ts | Periodic probe state transitions |
fhir-practitioner.integration.spec.ts | FHIR R4 CRUD |
4. Contract tests
| Consumer | What |
|---|
| scheduling-service | practitioner.created/updated event shape |
| orders-service | /internal/privileges response |
| facility-service | practitioner.created triggering membership |
| interop-service | FHIR projection |
5. E2E tests
| Flow | Tool |
|---|
| Onboard consultant with credentials and assign role | Playwright |
| Credential expiry fires notification | Playwright + scheduler harness |
| Search by local-script name | Playwright |
| Scenario | Target |
|---|
| Privilege check 2000 rps | p99 ≤ 30ms |
| Search 500 rps | p95 ≤ 500ms |
| Credential scan 100k rows | ≤ 5 minutes |
7. Security tests
- RLS verified per role.
- Credential number never returned in search responses.
- Deactivated practitioner cannot be assigned a new role.