Commanded v0.15.0 Commanded.Assertions.EventAssertions View Source
Provides test assertion and wait for event functions to help test applications built using Commanded.
The default receive timeout is one second.
You can override the default timeout in config (e.g. config/test.exs
):
config :commanded,
assert_receive_event_timeout: 1_000
Link to this section Summary
Functions
Assert that an event of the given event type is published. Verify that event using the assertion function
Assert that an event of the given event type, matching the predicate, is published. Verify that event using the assertion function
Wait for an event of the given event type to be published
Wait for an event of the given event type, matching the predicate, to be published
Link to this section Functions
Assert that an event of the given event type is published. Verify that event using the assertion function.
Examples
assert_receive_event BankAccountOpened, fn opened ->
assert opened.account_number == "ACC123"
end
Assert that an event of the given event type, matching the predicate, is published. Verify that event using the assertion function.
Examples
assert_receive_event BankAccountOpened,
fn opened -> opened.account_number == "ACC123" end,
fn opened ->
assert opened.balance == 1_000
end