ExUnit assertions for events appended to a Chronicle.Testing.start_supervised_client/1
client, and for the structured rejections Chronicle.EventSequences.EventLog returns.
import Chronicle.Testing.Assertions
:ok = Chronicle.EventSequences.EventLog.append("account-1", %AccountOpened{}, client: client)
assert_appended(client, %AccountOpened{}, event_source_id: "account-1")
{:error, _} = Chronicle.EventSequences.EventLog.append("account-1", %AccountOpened{}, client: client)
assert_constraint_violation(result, "UniqueAccount")
Summary
Functions
Asserts that at least one appended event matches matcher.
Asserts that result is a concurrency-violation rejection.
Asserts that result (as returned by Chronicle.EventSequences.EventLog.append/3 and
friends) is a constraint-violation rejection, optionally for the named constraint.
Asserts that no appended event matches matcher. See assert_appended/3 for
the accepted matcher shapes and options.
Functions
Asserts that at least one appended event matches matcher.
matcher is an exact event struct (compared with ==), an event type module
(matches any event of that type), or a 1-arity function predicate.
Options
:event_source_id— only consider events appended for this event source:count— assert exactly this many matches, instead of "at least one"
@spec assert_concurrency_violation(term()) :: true
Asserts that result is a concurrency-violation rejection.
Asserts that result (as returned by Chronicle.EventSequences.EventLog.append/3 and
friends) is a constraint-violation rejection, optionally for the named constraint.
Asserts that no appended event matches matcher. See assert_appended/3 for
the accepted matcher shapes and options.