How do you test aggregate-partials? #404
-
Hi, thanks for the work on an awesome package! I must be missing something, i can't seem to wrap my head around a nice way to test aggregatePartials behaviour.
But obviously this is not how it's meant to be used. Can anyone point me in the right direction? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @ovp87 I think the approach you've listed is actually the right one. You can depend on the test for the AggregateRoot itself to test the behaviour or cover it directly by using fake() on the partial. If you want to learn more its actually covered specifically in the Spatie Event Sourcing book on pages 135 & 136. |
Beta Was this translation helpful? Give feedback.
-
Aggregate partials are like traits: they're a nice way to split a class in multiple parts but still should be considered part of that class. Ideally, the aggregate root is the subject of your test. Partials are an implementation detail. |
Beta Was this translation helpful? Give feedback.
Aggregate partials are like traits: they're a nice way to split a class in multiple parts but still should be considered part of that class.
Ideally, the aggregate root is the subject of your test. Partials are an implementation detail.