asyncredux-testing-basics - 使用 Store 直接测试 AsyncRedux Action
指导使用 Store 为 AsyncRedux Action 编写单元测试,涵盖状态断言、异步动作、ActionStatus 及 MockStore。
标签
更新于: 2026-09-21能力
典型输入
典型输出
该技能可以做什么
- 创建测试 Store
- 分发并等待 Action
- 测试异步 Redux Action
- 并行分发多个 Action
- 使用 ActionStatus 验证错误
- 测试 UserException 异常
- 检查 Store 错误队列
- 验证出错时状态保持不变
- 使用 MockStore 模拟 Action
- 等待特定状态条件
输入
- ReduxAction 类
- 初始 AppState 状态
- 测试数据
输出
- 更新后的 AppState
- ActionStatus 对象
- Store 错误队列记录
- 测试断言结果
要求
- Flutter 测试框架
- async_redux 软件包
