hako_test library

Testing library for Hako state management.

Provides utilities for testing BaseHako state containers, asserting on event stream emissions, running declarative tests, and matching Hako events.

Functions

expectHakoEmits<T extends BaseHako>(T hako, FutureOr<void> execution(T hako), Iterable matchers, {String? reason, dynamic skip}) → Future<void>
Asserts that executing execution on a hako instance emits a sequence of HakoEvents matching matchers in order, followed by stream completion.
hakoTest<H extends BaseHako>(String description, {required H build(), FutureOr<void> setUp(H hako)?, FutureOr<void> act(H hako)?, dynamic expect()?, FutureOr<void> verify(H hako)?, FutureOr<void> tearDown(H hako)?, dynamic skip, dynamic tags, int? retry, Duration? timeout}) → void
Creates a new BaseHako-specific test case with the given description.
isGetEvent<T>({String? name, dynamic state}) → Matcher
Returns a matcher that asserts a GetEvent of type T was emitted.
isSetEvent<T>({String? name, dynamic previous, dynamic current}) → Matcher
Returns a matcher that asserts a SetEvent of type T was emitted.