Skip to content

Instantly share code, notes, and snippets.

@ovidiuch
Last active December 7, 2017 14:03
Show Gist options
  • Save ovidiuch/12de18e8c0c351b5fb54fea872bbadc4 to your computer and use it in GitHub Desktop.
Save ovidiuch/12de18e8c0c351b5fb54fea872bbadc4 to your computer and use it in GitHub Desktop.
const onReply = jest.fn();
const wrapper = shallow(<UnrealisticComponent onReply={onReply} />)
test('kindly asks if everything is alright', () => {
expect(wrapper.text()).toBe('Alles gut?')
})
test('receives positive response upon click', () => {
wrapper.find('button').simulate('click')
expect(onReply).toHaveBeenCalledWith('Ja')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment