Deep DivesNotification

Testing

Testing guide for the RawStack Notification component.

The Notification service primarily relies on Jest-based unit tests. As a general rule, tests should cover strategy selection, content generation, and provider behaviour without sending real notifications.

Unit tests

Tests run with Jest.

npm run test

Test focus

The most useful test coverage usually comes from:

  • strategies: assert that the correct channels are selected and that content is built correctly for a given event payload
  • providers: mock the Resend and Twilio SDKs and assert that the correct calls are made
  • content builders and templates: render email templates to HTML and check that expected values appear in the output

Email previews

React Email includes a development server for previewing templates in a browser. From the notification service directory:

npx email dev

This renders the available templates locally so you can iterate on email output without sending real messages.