Deep DivesNotification

Testing

Testing guide for the RawStack Notification component.

Unit tests

Tests run with Jest.

npm run test

What to test

Strategies — assert that the correct channels are selected and the content builder produces the expected output for a given event payload.

Providers — mock the Resend and Twilio SDKs and assert that the correct API calls are made with the expected parameters.

Content builders — render React Email templates to HTML and assert the output contains expected values (subject, links, recipient details).

Email previews

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

npx email dev

This renders all templates in src/content/ at http://localhost:3000 so you can iterate on designs without sending real emails.