runAjwahTest<State> function
- @visibleForTesting
Internal ajwahTest runner which is only visible for testing. This should never be used directly -- please use ajwahTest instead.
Implementation
@visibleForTesting
Future<void> runAjwahTest<State>(
String description, {
@required Stream<State> Function() build,
Function act,
Duration wait,
int skip = 0,
Iterable expect,
Function(List<State> models) verify,
Iterable errors,
Function tearDown,
}) async {
final unhandledErrors = <Object>[];
await runZoned(
() async {
final states = <State>[];
final stream = build();
final subscription = stream.skip(skip).listen(states.add);
await act?.call();
if (wait != null) await Future<void>.delayed(wait);
await Future<void>.delayed(Duration.zero);
if (expect != null) test.expect(states, expect);
await subscription.cancel();
await verify?.call(states);
await tearDown?.call();
},
onError: (Object error) {
unhandledErrors.add(error);
},
);
if (errors != null) test.expect(unhandledErrors, errors);
}