A reference guide to testing patterns for event-sourced applications, covering command handlers (Given/When/Then with events), projections (Given events/When query/Then response), and process managers (Given events/Then command or I/O). Key insight: testing projection state is an anti-pattern at the domain level — tests should verify observable behaviour via Query responses, not internal state, keeping tests decoupled from implementation details and enabling fast in-memory testing. Integration tests for state/schema correctness are still valid but should be minimal.
Table of contents
Command handlersProjectionsProcess managersNotesTesting Projection State is an anti-pattern30 Impressions