bloc_presentation_test library

A testing library for bloc_presentation.

Classes

MockPresentationBloc<E, S, P>
A mock for BlocPresentationMixined blocs. Allows managing presentation stream. It automatically mocks all fields and methods. It allows to add presentation events to bloc's presentation stream.
MockPresentationCubit<S, P>
A mock for BlocPresentationMixined cubits. Allows managing presentation stream. It automatically mocks all fields and methods. It allows to add presentation events to cubit's presentation stream.

Functions

blocPresentationTest<B extends BlocPresentationMixin<State, P>, State, P>(String description, {required B build(), FutureOr<void> setUp()?, State seed()?, dynamic act(B bloc)?, Duration? wait, int skipPresentation = 0, required dynamic expectPresentation(), FutureOr<void> tearDown()?, dynamic tags}) → void
This function provides a possibility to test blocs/cubits with BlocPresentationMixin mixed in.
testBlocPresentation<B extends BlocPresentationMixin<State, P>, State, P>({FutureOr<void> setUp()?, required B build(), State seed()?, dynamic act(B bloc)?, Duration? wait, int skipPresentation = 0, required dynamic expectPresentation(), FutureOr<void> tearDown()?, dynamic tags}) Future<void>
Internal blocPresentationTest runner which is only visible for testing. This should never be used directly -- please use blocPresentationTest instead.
whenListenPresentation<T>(BlocPresentationMixin<dynamic, T> bloc, {List<T>? initialEvents}) StreamController<T>
Creates a StreamController, stubs bloc's presentation stream with created controller's stream and returns newly created controller. Newly created controller is automatically closed when bloc's close method is called.