asyncredux-testing-view-models
Installation
SKILL.md
Testing View-Models in AsyncRedux
View-models created by VmFactory can be tested in isolation without building widgets. Use Vm.createFrom() to instantiate the view-model directly, then verify properties and execute callbacks.
Creating a View-Model for Testing
Use Vm.createFrom() with a store and factory instance:
import 'package:flutter_test/flutter_test.dart';
import 'package:async_redux/async_redux.dart';
test('view-model has correct properties', () {
var store = Store<AppState>(
initialState: AppState(name: 'Mary', counter: 5),
);
var vm = Vm.createFrom(store, CounterFactory());