Skip to main content

Testing

:::info Source Sourced from services/notification-service/TESTING_STRATEGY.md in the documentation repo. :::

1. Coverage

Domain 95%/80% mutation. Integration 80%.

2. Unit

  • Template rendering (variables, i18n).
  • Preference matching (user opts in/out).
  • Suppression list enforcement.
  • Rate-limit + throttle logic.
  • Digest batching.

3. Integration (Testcontainers)

  • Postgres + NATS + mock SES/Twilio/FCM.
  • Flow: event consumed → template selected → rendered → queued → sent → receipt.

4. Contract Tests

  • Consumer of every service that triggers notifications.
  • Outbound webhooks from tenants (optional).

5. E2E

  • J-01: new user → welcome email.
  • J-02: assignment overdue → escalation email + push.
  • J-03: password reset → magic link.

6. Load Tests

  • 10k emails/min burst; 1k sustained.
  • Digest: 100k daily digests rendered + batched.

7. Security Tests

  • Phishing template (suspicious content) → blocked.
  • SMS to blacklisted country → rejected.
  • Spoofed webhook → rejected.

8. A11y Tests

  • Email HTML accessible (plain-text fallback + semantic structure).

9. CI Gates

Unit + integration + Pact + iso + mutation ≥ 80%.