bloc_presentation_test
1.2.0, released 2 years ago by leancode.co
A testing library for Blocs and Cubits utilizing BlocPresentationMixin.
WASM-ready
What it does
Provides utility functions and mock classes to test presentation streams in Blocs and Cubits that use the BlocPresentationMixin. It offers approaches like whenListenPresentation and MockPresentationBloc to facilitate stream testing.
AI-written summary of version 1.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are testing Blocs or Cubits that use the bloc_presentation package
- You need to verify presentation events emitted by your state management components
Skip it when
- You are not using the bloc_presentation package in your app
- You are using a different state management approach like Riverpod or Provider
Strengths
- Simplifies testing of presentation streams with mock utilities
- Integrates well with mocktail and bloc testing workflows
Weaknesses
- Strictly tied to the bloc_presentation package ecosystem
- Limited usefulness outside of specific mixin-based Bloc architectures
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 6
Add the package as a dev dependency in pubspec.yaml.
final mockCubit = MockCommentCubit();
final controller = whenListenPresentation(mockCubit);
controller.add(const FailedToUpvote());Alternatives
Packages that do the same job and could replace bloc_presentation_test.
Works with
Packages commonly used together with bloc_presentation_test: ones it builds on, ones built on it, and its own family.
- testbloc_presentation_test depends on itA full featured library for writing and running Dart tests across platforms.
- mocktailbloc_presentation_test depends on itDart mock library with null safety support and no manual mocks or code generation.
- blocbloc_presentation_test depends on itA Dart library for implementing the BLoC pattern with Cubits and Blocs.
- diff_match_patchbloc_presentation_test depends on itDart library implementing diff, match and patch algorithms for plain text.
- bloc_presentationbloc_presentation_test depends on itDispatch single-time side effects from Bloc or Cubit without polluting state.