testing library
Testing utilities for Juice blocs.
This library provides helpers for testing Juice blocs including:
- BlocTester for simplified bloc testing with assertions
Usage
import 'package:juice/testing.dart';
void main() {
test('counter increments', () async {
final bloc = CounterBloc();
final tester = BlocTester(bloc);
await tester.send(IncrementEvent());
tester.expectState((s) => s.count == 1);
tester.expectLastStatusIs<UpdatingStatus>();
await tester.dispose();
});
}
Classes
-
BlocTester<
TBloc extends JuiceBloc< TState> , TState extends BlocState> - A test utility class for testing Juice blocs.
Extensions
-
BlocTesterExtension
on JuiceBloc<
TState> - Extension to create a tester directly from a bloc.