Skip to content

Instantly share code, notes, and snippets.

@whtswrng
Last active November 27, 2018 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whtswrng/4f8029b6e329629a85ac89bbc1d4fb52 to your computer and use it in GitHub Desktop.
Save whtswrng/4f8029b6e329629a85ac89bbc1d4fb52 to your computer and use it in GitHub Desktop.
react-testing-1
describe("when input changed", () => {
it("should change property name in the state", () => {
const componentWrapper = shallow(<Login />);
componentWrapper.find('#email').simulate('change', {target: {name: 'email', value: 'blah@gmail.com'}});
expect(componentWrapper.state('email')).toEqual('blah@gmail.com');
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment