Created
May 18, 2018 04:53
-
-
Save dferber90/88630dcdaeb3e2a8de7adaf72973b93a to your computer and use it in GitHub Desktop.
Test a Render Prop!
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
| import { shallow } from 'enzyme' | |
| describe('when the mouse moves', () => { | |
| const renderMock = jest.fn(); | |
| const wrapper = shallow(<Mouse render={renderMock} />); | |
| wrapper.find('div').simulate('mousemove', { | |
| clientX: 50, | |
| clientY: 20, | |
| }); | |
| it('should call `render` with the mouse coordinates', () => { | |
| expect(renderMock).toHaveBeenCalledWith({ x: 50, y: 20 }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment