Last active
May 22, 2017 12:34
-
-
Save visualskyrim/14ba72d877dc85a5fc0709c976a51404 to your computer and use it in GitHub Desktop.
Use Enzyme to test React/Redux container - simulate & find
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); | |
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