JEffectRecorder class
Plays the role of the UI for a JController in tests: it records emitted effects and completes the awaitable ones with scripted responses.
Responses are registered per concrete effect type. An awaitable effect with no registered response is left pending, so tests can assert on timeouts or complete it manually; use failUnhandled to fail it instead.
final ui = JEffectRecorder(controller)
..respondTo<ConfirmDelete, bool>((effect) => true);
await controller.intent(DeleteIntent());
expect(ui.effects.single, isA<ConfirmDelete>());
ui.dispose();
Constructors
-
JEffectRecorder(JController<
JState> controller, {bool failUnhandled = false})
Properties
-
effects
→ List<
JEffect> -
Every effect received, in emission order.
no setter
- failUnhandled → bool
-
Whether awaitable effects without a registered response complete with a
StateError instead of staying pending.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void - Forgets the recorded effects; registered responses are kept.
-
dispose(
) → Future< void> - Stops listening. Pending effects are left untouched.
-
effectsOfType<
E extends JEffect> () → List< E> -
The received effects of type
E. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
respondTo<
E extends JEffect< (V> , V>V response(E effect)) → void -
Completes effects of exactly type
Ewith the valueresponsereturns. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited