expectErrors method

void expectErrors(
  1. Object expected
)

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.

A refused reaction chain is not an error to claim: it always fails the test.

Implementation

void expectErrors(Object expected) {
  _checkRunning();
  final errors = List.of(_recorder.errors);
  _recorder.errors.clear();
  m.expect(errors, m.wrapMatcher(expected),
      reason: 'juiceFlowTest: errors recorded');
}