expect method
Asserts on what bloc emitted since its last expect (or since it
was watched), exactly and in order, and consumes it.
expected is one matcher (or value) per emission — isUpdatingStatus,
isWaitingStatus, isFailureStatus, isCancelingStatus — or a single
matcher over the whole list. Order is asserted per bloc, not across
blocs.
Implementation
void expect(JuiceBloc<BlocState> bloc, Object expected) {
_checkRunning();
final watch = _watched[bloc];
if (watch == null) {
throw ArgumentError('juiceFlowTest: this ${bloc.runtimeType} is not '
'watched — hand it to the flow with add or register');
}
final emitted = List.of(watch.pending);
watch.pending.clear();
m.expect(emitted, asEmissionsMatcher(expected),
reason: 'juiceFlowTest: ${watch.name} emitted $emitted');
}