Last active
August 6, 2017 14:40
-
-
Save visualskyrim/a158c05a04f32f563cdf5936d9510853 to your computer and use it in GitHub Desktop.
Use Enzyme to test React/Redux container - dispatch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("should render a text box with no string inside if search string is not provided by store", () => { | |
const testState = { | |
showBox: { | |
search: "" | |
} | |
}; | |
const store = createMockStore(testState) | |
const component = shallowWithStore(<ConnectedShowBox />, store); | |
component.dive().find("form > div > input").simulate("change", { target: { value: "Site" } }); | |
expect(component.dive().find("d").prop("value")).to.equal("Site") | |
component.dive().find("form").simulate("submit"); | |
expect(store.isActionDispatched({ | |
type: "showBox/SUBMIT", | |
searchString: "Site" | |
})).to.be.true; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment