Skip to content

Instantly share code, notes, and snippets.

@visualskyrim
Last active May 22, 2017 12:22
Show Gist options
  • Select an option

  • Save visualskyrim/4339c2532aeb77e350a4d50a49c09b4e to your computer and use it in GitHub Desktop.

Select an option

Save visualskyrim/4339c2532aeb77e350a4d50a49c09b4e to your computer and use it in GitHub Desktop.
Use Enzyme to test React/Redux container - Code List 4
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