JuiceFlow class final
The blocs of one juiceFlowTest: what the test body is handed.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add<
TBloc extends JuiceBloc< (BlocState> >TBloc bloc) → TBloc -
Watches
bloc, which the test built: its emissions are recorded from now on and must all be consumed by expect. The flow closes it when the test ends. Returnsbloc. -
elapse(
Duration duration) → Future< void> -
Lets
durationpass — exactly that much — and whatever falls due in it run. It does NOT wait for idle: use it to act in the middle of a delay, then settle. On the real clock it really waits; under virtual time the clock jumps. -
expect(
JuiceBloc< BlocState> bloc, Object expected) → void -
Asserts on what
blocemitted since its last expect (or since it was watched), exactly and in order, and consumes it. -
expectErrors(
Object expected) → void - Asserts on the errors recorded since the last expectErrors, in order, and claims them: the error of every error-level telemetry entry — a use case that threw, a reaction callback that threw, a stream-binding error, an event with no use case — each once, however many entries carry it. Without it, any such error fails the test.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register<
TBloc extends JuiceBloc< (BlocState> >TBloc factory()) → TBloc -
Registers
TBlocinBlocScopeas a permanent bloc, builds it at once, and watches it as add does. Returns the instance — the one a reaction that namesTBlocby type resolves. -
send(
JuiceBloc< BlocState> bloc, EventBase event, {Duration timeout = defaultTimeout}) → Future<void> -
Sends
eventtoblocand waits until every bloc is idle — the run it starts, every reaction that follows from it, and every run those start. Fails as settle fails; rethrows what the send's own future failed with (an error handler that threw). An event with no use case does not fail the send: it is recorded as an error, for expectErrors. -
settle(
{Duration timeout = defaultTimeout}) → Future< void> -
Waits until every bloc in the process is idle: no send in flight
(waiting in a
sequentialqueue counts), no reaction hop pending, nosendAfterstill waiting to fire — and still none one turn of the event loop later. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultTimeout → const Duration
- How long send and settle wait for the blocs to go idle before they fail.