marcglasberg / async_redux

Flutter Package: A Redux version tailored for Flutter, which is easy to learn, to use, to test, and has no boilerplate. Allows for both sync and async reducers.
Other
234 stars 40 forks source link

Fix wait-condition seeing action of previous test-infos #66

Closed ghost closed 4 years ago

ghost commented 4 years ago

There's a situation in which StoreTester.waitCondition() is able to see the TestInfo.action of a previous wait-condition when testImmediately: true. Take the following code as an example:

storeTester.dispatch(Action1());

await storeTester.waitCondition(
  (info) => (info.action is Action1),
  testImmediately: true,
);

await storeTester.waitCondition(
  (info) => (info.action is Action1) ? throw AssertionError() : true,
  testImmediately: true,
);

Previously, this code would throw an assertion error. This patch fixes that problem by making info.action be null when testing the condition immediately.