Testing
:::info Source
Sourced from services/enrollment-service/TESTING_STRATEGY.md in the documentation repo.
:::
1. Coverage
Domain 95%/80% mutation. Integration 80%.
2. Unit
- State machine transitions.
- Idempotency on source.ref.
- ABAC predicate evaluation (learner vs manager vs admin).
- Expiration scheduler correctness.
3. Integration
- Postgres + NATS.
- Purchase saga: consume license.granted → create enrollment → emit.
- Assignment: window.opened → deferred; play → enroll.
- Completion → enrollment.completed.
- Revocation → cascade.
4. Contract
Pact: ← marketplace (license.granted); ← assignment (window.opened); ← progress (completion.recorded); → content (for bundle); → notification; → certification; → analytics.
5. E2E
- J-06 (purchase flow).
- J-07 (refund flow).
- J-13 (assignment flow).
6. Load
- Bulk enrollment: 50k rows in 5 min.
- 10k concurrent reads.
7. Chaos
- Duplicate license.granted → single enrollment.
- Revocation during active play → graceful unmount.
8. Security
- Cross-tenant access denied.
- Spoofed userId via JWT → JWT validated.
- Bulk without admin role → 403.
9. GDPR
- Erasure replay.
10. CI Gates
Standard gates + two-tenant iso + mutation ≥ 80%.