blob: c201646d232a582caf938202808d6f2116538ba4 [file] [edit]
import 'package:checks/checks.dart';
import 'package:test/scaffolding.dart';
void main() {
test('anyOf', () async {
// This check succeeds, the second condition is satisfied.
await check(Stream.fromIterable(['ready'])).withQueue.anyOf([
.it()..emits(.it()..equals('starting')),
.it()..emits(.it()..equals('ready')),
]);
// This check fails because no condition is satisfied.
await check(
Stream.fromIterable(['ready']),
).withQueue.anyOf([.it()..emits(.it()..equals('starting')), .it()..isDone]);
// Expected: a Stream<String> that:
// satisfies one of:
// emits 'starting'
// or,
// is done
// Actual: a stream
// Which: failed to satisfy any condition
// failed the condition at index 0 because it:
// Actual: emits 'ready'
// Which: differs at offset 0:
// starting
// ready
// ^
// failed the condition at index 1 because it:
// Actual: a stream that emitted 'ready'
// Which: emitted a value before closing
});
}