Skip to content
You're viewing documentation for v0.5.0. It may be out of date.Go to latest
Email SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

Test email behavior

Assert sends, retries, fallbacks, and plugin behavior.

Use the memory provider when you want to replace the provider. Use the capture plugin when you want to observe the normal send pipeline.

Memory provider

The memory provider stores successful sends and never calls an external API.

Capture plugin

The capture plugin records lifecycle events. It can be used with the memory provider or with a custom test adapter.

Assert defaults

Defaults run before message validation, so tests can assert the final message that reached the provider.

Assert fallback

Use failingProvider() for the primary route and memoryProvider() for the backup route. Assert the response provider and the backup send store.

Assert retry

Use a provider that fails once with a retryable error, then succeeds.

Test checklist

  • Use memoryProvider() for app tests that should not call real providers.
  • Use capturePlugin() when you need lifecycle events.
  • Assert provider field support with adapter unit tests.
  • Add one test for fallback if the route matters.
  • Test fallback routes with the same message shape used in production.
  • Add one test for plugin ordering when multiple plugins mutate the same message.

Last updated on