Recipes
Assert a terminal Execution contract
Match only the lifecycle fields that define the behavior under test.
v0.1.0-dev.1Intermediateusecase_forge_test
Open source reference ↗Assert a terminal Execution contract
Use field-aware matchers instead of comparing a complete Entry whose unrelated timestamps or metadata may change.
dart
expect(
useCase.history,
contains(
isTerminalUseCaseExecutionEntry<LoadOrder>(
result: UseCaseExecutionResult.completed,
),
),
);
For a complete scenario, useCaseTest subscribes before act, waits on an explicit observable condition, verifies Snapshots and history, then closes the UseCase. Use a manual UseCaseTestObserver when several Commands require staged assertions.
A pre-processing rejection is intentionally absent from terminal history. Verify an application rejection hook directly or use diagnostics when rejection events are part of the requirement.