Skip to content

Commit

Permalink
Use Kernel.struct/2 to build initial aggregate state in aggregate c…
Browse files Browse the repository at this point in the history
…ase template

This is how initial aggregate state is built in the aggregate module and allows `@enforce_keys` to be used for aggregate state.
  • Loading branch information
slashdotdash committed Jan 27, 2020
1 parent 3b1e8cd commit f8cc085
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/support/aggregate_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ defmodule Commanded.AggregateCase do

# Apply the given commands to the aggregate hydrated with the given initial_events
defp aggregate_run(initial_events, commands) do
%@aggregate{}
@aggregate
|> struct()
|> evolve(initial_events)
|> execute(commands)
end
Expand Down

0 comments on commit f8cc085

Please sign in to comment.