Last active
March 13, 2018 12:40
-
-
Save fakiolinho/fb2feab60a6feff26dc99c6d9d998293 to your computer and use it in GitHub Desktop.
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 React from 'react'; | |
import { shallow } from 'enzyme'; | |
import Options from './'; | |
describe('test Options component', () => { | |
it('instance method handleAdd should be triggered when add button gets clicked', () => { | |
const enzymeWrapper = shallow(<Options />); | |
enzymeWrapper.instance().handleAdd = jest.fn(); | |
enzymeWrapper.find('button').at(0).simulate('click'); | |
expect(enzymeWrapper.instance().handleAdd).toHaveBeenCalledTimes(1); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment