blob: 888ab8bee2f375149abba54f6050bcccc882a8f7 [file]
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:
// Expected: emits 'starting'
// Actual: emits 'ready'
// Which: differs at offset 0:
// starting
// ready
// ^
// failed the condition at index 1 because it:
// emitted an unexpected value: 'ready'
});
}