Last active
October 21, 2018 10:41
-
-
Save whtswrng/17f7a8f06b0790a8b94b3321f4f180da to your computer and use it in GitHub Desktop.
react-testing-2
This file contains 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('when valid email was filled', () => { | |
beforeEach(() => { | |
subscribe = jest.fn(); | |
wrapper = mount(<Subscription subscribe={subscribe}/>); | |
}); | |
describe('and when form was submitted', () => { | |
beforeEach(() => { | |
... | |
wrapper.find('#email').simulate('change', {target: {name: 'email', value: 'blah@gmail.com'}}); | |
wrapper.find('#submit').simulate('submit'); | |
}); | |
it('should subscribe to the news with correct email', () => { | |
expect(subscribe).toHaveBeenCalledWith({email: 'blah@gmail.com'}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment