Skip to content

Instantly share code, notes, and snippets.

@carlosble
Created April 5, 2017 18:52
Show Gist options
  • Save carlosble/fac838dbdcd2d7afe509828d77d6d404 to your computer and use it in GitHub Desktop.
Save carlosble/fac838dbdcd2d7afe509828d77d6d404 to your computer and use it in GitHub Desktop.
Asserting agains the store
beforeEach(function () {
spyRouter = { push: jest.fn() };
initialState = {profile: {id: '123456789H'}};
store = configureStore(initialState);
});
it("clears store's state on logout", (done) => {
expect(store.getState().profile.id).toEqual(initialState.profile.id);
store.subscribe(() => {
expect(store.getState().profile.id).toEqual('');
done();
});
mountLogoutPage();
});
function mountLogoutPage() {
let LogoutPage = createLogoutPage();
mount(
<Provider store={store}>
<LogoutPage router={spyRouter} />
</Provider>);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment