'Jest & Redux - Set test initialState
I want write test with Jest for my app. I want set a mock initial state in test file but i can't find to way.
describe("Polls", () => {
it("should create an poll", () => {
const data = {
id: "59284848183",
name: "Google",
link: "hhttps://www.google.com.tr",
point: 0,
createdDate: new Date().getTime(),
lastUpdate: new Date().getTime(),
};
store.dispatch(addPoll(data));
expect(store.getState().polls.polls).toEqual([...initialState, data]);
});
});
I want to check is data added to store
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
