Skip to content

Instantly share code, notes, and snippets.

@visualskyrim
Last active May 22, 2017 12:34
Show Gist options
  • Save visualskyrim/14ba72d877dc85a5fc0709c976a51404 to your computer and use it in GitHub Desktop.
Save visualskyrim/14ba72d877dc85a5fc0709c976a51404 to your computer and use it in GitHub Desktop.
Use Enzyme to test React/Redux container - simulate & find
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);
expect(component).to.be.a('object');
expect(component.dive().find("").prop("value")).to.equal("")
component.dive().find("").simulate("change", { target: { value: "Site" } });
expect(component.dive().find("d").prop("value")).to.equal("Site")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment