riverpod_test library

A testing library which makes it easy to test riverpod providers. Built to be used with the riverpod package.

Functions

asyncNotifierTest<C extends AsyncNotifierBase<State>, State>({required AsyncNotifierProviderBase<C, State> provider, FutureOr<void> setUp()?, List<Override> overrides = const [], dynamic expect()?, AsyncValue<State>? seed, dynamic act(C notifier)?, Duration? wait, int skip = 0, dynamic verify(C notifier)?, dynamic errors()?, FutureOr<void> tearDown()?, bool emitBuildStates = false}) Future<void>
Internal testAsyncNotifier runner which is only visible for testing. This should never be used directly - please use testAsyncNotifier instead.
notifierTest<C extends NotifierBase<State>, State>({required NotifierProviderBase<C, State> provider, FutureOr<void> setUp()?, List<Override> overrides = const [], dynamic expect()?, State? seed, dynamic act(C notifier)?, Duration? wait, int skip = 0, dynamic verify(C notifier)?, dynamic errors()?, FutureOr<void> tearDown()?, bool emitBuildStates = false}) Future<void>
Internal testNotifier runner which is only visible for testing. This should never be used directly - please use testNotifier instead.
providerTest<State>({required ProviderBase<State> provider, FutureOr<void> setUp()?, List<Override> overrides = const [], dynamic expect()?, Duration? wait, dynamic verify()?, dynamic errors()?, FutureOr<void> tearDown()?}) Future<void>
Internal testProvider runner which is only visible for testing. This should never be used directly - please use testProvider instead.
resultProviderTest<Result>({required ProviderBase<Result> provider, FutureOr<void> setUp()?, List<Override> overrides = const [], dynamic expect()?, dynamic verify(Result result)?, dynamic errors()?, FutureOr<void> tearDown(Result result)?, dynamic act(Result result)?}) Future<void>
Internal testResultProvider runner which is only visible for testing. This should never be used directly, please use testResultProvider instead.
stateNotifierTest<C extends StateNotifier<State>, State>({required StateNotifierProvider<C, State> provider, FutureOr<void> setUp()?, List<Override> overrides = const [], dynamic expect()?, State? seed, dynamic act(C notifier)?, Duration? wait, dynamic verify()?, dynamic errors()?, FutureOr<void> tearDown()?, bool emitBuildStates = false}) Future<void>
Internal testStateNotifier runner which is only visible for testing. This should never be used directly - please use testStateNotifier instead.
testAsyncNotifier<C extends AsyncNotifierBase<State>, State>(String description, {required AsyncNotifierProviderBase<C, State> provider, FutureOr<void> setUp()?, List<Override> overrides = const [], dynamic expect()?, AsyncValue<State>? seed, dynamic act(C notifier)?, Duration? wait, int skip = 0, dynamic verify(C notifier)?, dynamic errors()?, FutureOr<void> tearDown()?, bool emitBuildStates = false}) → void
Creates a new AsyncNotifier test case with the given description. testAsyncNotifier will handle asserting that the notifier emits the expected states (in order) after act is executed. testAsyncNotifier also handles ensuring that no additional states are emitted by closing the provider before evaluating the expectation.
testNotifier<C extends NotifierBase<State>, State>(String description, {required NotifierProviderBase<C, State> provider, FutureOr<void> setUp()?, List<Override> overrides = const [], dynamic expect()?, State? seed, dynamic act(C notifier)?, Duration? wait, int skip = 0, dynamic verify(C notifier)?, dynamic errors()?, FutureOr<void> tearDown()?, bool emitBuildStates = false}) → void
Creates a new Notifier test case with the given description. testNotifier will handle asserting that the notifier emits the expected states (in order) after act is executed. testNotifier also handles ensuring that no additional states are emitted by closing the provider before evaluating the expectation.
testProvider<State>(String description, {required ProviderBase<State> provider, FutureOr<void> setUp()?, List<Override> overrides = const [], dynamic expect()?, Duration? wait, dynamic verify()?, dynamic errors()?, FutureOr<void> tearDown()?}) → void
Creates a new Provider test case with the given description. testProvider will handle asserting that the provider emits the expected after provider is read.
testResultProvider<Result>(String description, {required ProviderBase<Result> provider, FutureOr<void> setUp()?, List<Override> overrides = const [], dynamic expect()?, dynamic verify(Result result)?, dynamic errors()?, FutureOr<void> tearDown(Result result)?, dynamic act(Result result)?}) → void
Creates a new Result Provider test case with the given description. testResultProvider will handle asserting that the provider result emits the expected after act is executed.
testStateNotifier<C extends StateNotifier<State>, State>(String description, {required StateNotifierProvider<C, State> provider, FutureOr<void> setUp()?, List<Override> overrides = const [], dynamic expect()?, State? seed, dynamic act(C notifier)?, Duration? wait, dynamic verify()?, dynamic errors()?, FutureOr<void> tearDown()?, bool emitBuildStates = false}) → void
Creates a new Notifier test case with the given description. testStateNotifier will handle asserting that the notifier emits the expected states (in order) after act is executed. testStateNotifier also handles ensuring that no additional states are emitted by closing the provider before evaluating the expectation.