Skip to content

Instantly share code, notes, and snippets.

@carlosble
Created June 7, 2017 22:08
Show Gist options
  • Save carlosble/285c0fede6700a6fba2eb8eee0dcd9cb to your computer and use it in GitHub Desktop.
Save carlosble/285c0fede6700a6fba2eb8eee0dcd9cb to your computer and use it in GitHub Desktop.
Eventually expect
it ('populates store with data returned from server', (done) => {
stubApiClientToReturn({username: 'carlos'});
simulateSearchFormSubmit({username: 'car'});
expectStoredUsersToContainUsername('carlos', done);
});
function expectStoredUsersToContainUsername(username, done){
store.subscribe(eventuallyExpect(() => {
expect(store.getState().users[0].username).to.equal(username);
}, done));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment