-
Notifications
You must be signed in to change notification settings - Fork 107
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
Test failing since v2.0.0 #126
Comments
Just a follow-up to say I re-wrote this with
Working test code: import { createMockStore } from 'redux-logic-test';
import { createLogic } from "redux-logic";
const ACTION_LOGOUT = "LOGOUT";
const ACTION_DO_SOMETHING = "DO_SOMETHING";
const logoutLogic = createLogic({
type: ACTION_LOGOUT,
latest: true,
process: (deps, dispatch, done) => {
dispatch({ type: ACTION_DO_SOMETHING });
done();
}
});
const initialState = {};
describe("logoutLogic", () => {
it("should dispatch expected actions", (done) => {
const store = createMockStore({ initialState, logic: [logoutLogic] });
store.dispatch({ type: ACTION_LOGOUT });
store.whenComplete(() => {
expect(store.actions).toEqual([
{ type: ACTION_LOGOUT },
{ type: ACTION_DO_SOMETHING }
]);
done();
});
});
}); |
@bbthorntz Thanks, that reminds me that I need to update redux-logic-test's peer deps so they are broader. I'm guessing that in the original test, one would have to wait slightly longer for all the actions to be delivered (like we do when using whenComplete). I have updated redux-logic-test@2 to allow a broader range of redux and redux-logic. |
@bbthorntz I've updated your original test with redux-mock-store to have it wait for actions to complete. See it here https://codesandbox.io/s/olplx0l4vy |
@jeffbski thanks! Other than being slightly more terse, is there any benefit to using |
I hadn't seen it before, but it looks to be pretty comparable. You should be fine to use either. |
Since updating to version 2.0.0 we have some failing tests. I have produced a reduced example below:
You can see the failing test in a Code Sandbox here:
https://codesandbox.io/s/949yypmly4
I'm assuming that this is probably not an issue when using
redux-logic-test
(I haven't tried yet) but it's weird nonetheless that it only fails since[email protected]
.If this is expected behaviour following the update please close the issue.
The text was updated successfully, but these errors were encountered: