stream_test_subscriber 1.0.0 copy "stream_test_subscriber: ^1.0.0" to clipboard
stream_test_subscriber: ^1.0.0 copied to clipboard

A Dart package that simplifies testing streams by providing a straightforward API for subscribing to and asserting values from a stream.

example/main.dart

import 'dart:async';

import 'package:stream_test_subscriber/stream_test_subscriber.dart';
import 'package:test/test.dart';

void main() {
  test(
    "should emit values that has been collected from the stream",
    () async {
      final controller = StreamController<int>();
      final subscriber = controller.stream.test();

      for (var value in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) {
        controller.add(value);
      }

      await subscriber.expectValues([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
    },
  );
}
1
likes
160
points
9
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart package that simplifies testing streams by providing a straightforward API for subscribing to and asserting values from a stream.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

test

More

Packages that depend on stream_test_subscriber