bloc_test 0.1.0 copy "bloc_test: ^0.1.0" to clipboard
bloc_test: ^0.1.0 copied to clipboard

outdated

A testing library which makes it easy to test blocs. Built to be used with the bloc state management package.

Bloc Test Package

Pub Build Status codecov Flutter.io Awesome Flutter Flutter Samples Star on GitHub Gitter License: MIT


A Dart package that makes testing blocs easy. Built to work with bloc and mockito.

Create a Mock Bloc #

import 'package:bloc_test/bloc_test.dart';
import 'package:mockito/mockito.dart';

class MockCounterBloc extends Mock implements CounterBloc {}

Stub the Bloc Stream #

// Create a mock instance
final counterBloc = MockCounterBloc();

// Stub the bloc `Stream`
whenListen(counterBloc, Stream.fromIterable([0, 1, 2, 3]));

// Assert that the bloc emits the stubbed `Stream`.
expectLater(counterBloc, emitsInOrder(<int>[0, 1, 2, 3])))

Dart Versions #

  • Dart 2: >= 2.0.0

Maintainers #

558
likes
0
pub points
98%
popularity

Publisher

verified publisherbloclibrary.dev

A testing library which makes it easy to test blocs. Built to be used with the bloc state management package.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

bloc, mockito

More

Packages that depend on bloc_test