usecase_forge_test library

Deterministic test helpers for UseCase Forge.

Classes

TestUseCaseClock
A UseCaseClock advanced directly by the test.
UseCaseTestObserver<S>
Records the public output of one UseCase without changing its behavior.
UseCaseTestStreamError
An error observed on UseCase.stream together with its original stack.

Functions

isFinishedUseCaseSnapshot<S>({Object? state = _unspecified, Object? result = _unspecified, Object? executionId = _unspecified, Object? reason = _unspecified}) → Matcher
Matches a finished lifecycle snapshot.
isInitialUseCaseSnapshot<S>({Object? state = _unspecified, Object? executionId = _unspecified}) → Matcher
Matches an initial lifecycle snapshot.
isProcessingUseCaseSnapshot<S>({Object? state = _unspecified, Object? result = _unspecified, Object? executionId = _unspecified, Object? reason = _unspecified}) → Matcher
Matches a processing lifecycle snapshot.
isTerminalUseCaseExecutionEntry<C extends UseCaseCommand>({Object? command = _unspecified, Object? id = _unspecified, Object? result = _unspecified, Object? reason = _unspecified}) → Matcher
Matches a terminal history entry for command type C.
isUseCaseExecutionEntry<C extends UseCaseCommand>({Object? command = _unspecified, Object? id = _unspecified, UseCaseExecutionPhase? phase, Object? result = _unspecified, Object? groupKey = _unspecified, Object? reason = _unspecified, Object? instructions = _unspecified, Object? createdAt = _unspecified, Object? queuedAt = _unspecified, Object? startedAt = _unspecified, Object? finishedAt = _unspecified}) → Matcher
Matches an execution entry whose command has exact Dart type C.
isUseCaseSnapshot<S>({Object? state = _unspecified, UseCaseExecutionPhase? phase, Object? result = _unspecified, Object? executionId = _unspecified, Object? reason = _unspecified}) → Matcher
Matches a snapshot by the fields supplied by the test.
isUseCaseTestStreamError({Object? error = _unspecified, Object? stackTrace = _unspecified}) → Matcher
Matches a stream error by the fields supplied by the test.
useCaseTest<U extends UseCase<S>, S>(String description, {required U build(), FutureOr<void> act(U useCase)?, FutureOr<void> waitFor(U useCase, UseCaseTestObserver<S> observer)?, Object? expectedSnapshots()?, Object? expectedHistory()?, Object? expectedStreamErrors()?, FutureOr<void> verify(U useCase)?, FutureOr<void> tearDown()?, bool includeInitialSnapshot = false, dynamic skip, Timeout? timeout, Object? tags}) → void
Registers a test around one newly built UseCase.