Last active
May 22, 2017 12:22
-
-
Save visualskyrim/4339c2532aeb77e350a4d50a49c09b4e to your computer and use it in GitHub Desktop.
Use Enzyme to test React/Redux container - Code List 4
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
| describe('ConnectedShowBox', () => { | |
| it("should render a text box with empty string inside if string is not provided by store", () => { | |
| const testState = { | |
| searchBox: { | |
| search: "" | |
| } | |
| }; | |
| const store = createMockStore(testState) | |
| const component = shallowWithStore(<ConnectedSearchBox />, store); | |
| expect(component.dive().find("form > div > input").prop("value")).to.equal("") | |
| component.dive().find("form > div > input").simulate("change", { target: { value: "Site" } }); | |
| expect(component.dive().find("form > div > input").prop("value")).to.equal("Site") | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment