Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different tests competing in modifying the store #711

Open
darrenchiu opened this issue Mar 24, 2017 · 0 comments
Open

Different tests competing in modifying the store #711

darrenchiu opened this issue Mar 24, 2017 · 0 comments

Comments

@darrenchiu
Copy link

darrenchiu commented Mar 24, 2017

I am trying to write some tests for my store but I found that different tests are competing in modifying the same store instance so my assertions are mostly failing when I run them together while each of them can pass if I run them one by one. How should I resolve this?

Below show an example, while the "SOME_ACTION" would not change the value of amount

it('test 1', done => {
  AltClaimFormStore.state.amount = 12.3;

  var action = ClaimFormActions.SOME_ACTION;
  alt.dispatcher.dispatch({ action });

  AltClaimFormStore.listen(function () {
    if (!AltClaimFormStore.state.isUpdating) {
      expect(AltClaimFormStore.state.amount).toBe(12.3);
      done();
    }
  });
});

it('test 2', done => {
  AltClaimFormStore.state.amount = 12.4;

  var action = ClaimFormActions.SOME_ACTION;
  alt.dispatcher.dispatch({ action });

  AltClaimFormStore.listen(function () {
    if (!AltClaimFormStore.state.isUpdating) {
      expect(AltClaimFormStore.state.amount).toBe(12.4);
      done();
    }
  });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant