What problem does it solve?
Testing AsyncRedux apps can be verbose and brittle. This Skill provides structured patterns and utilities to write reliable unit tests that exercise the Store, actions, and async flows.
Core Features & Use Cases
- Create test Stores with deterministic initial state for isolated tests.
- Dispatch actions using dispatchAndWait and dispatchAndWaitAll and assert the resulting state.
- Validate ActionStatus to detect success or failure and inspect errors.
- Use MockStore to isolate tests by replacing or suppressing actions.
- Use advanced wait utilities to coordinate complex async scenarios.
Quick Start
Create a test file with flutter_test and async_redux, build a simple Store, dispatch an action using dispatchAndWait, and assert the resulting state. For example:
import 'package:flutter_test/flutter_test.dart';
import 'package:async_redux/async_redux.dart';
void main() {
test('increments counter', () async {
var store = Store<AppState>(initialState: AppState(counter: 0));
await store.dispatchAndWait(IncrementAction());
expect(store.state.counter, 1);
});
}