mocked event in simulated click

This commit is contained in:
Ben Wheeler 2019-10-16 17:59:15 -04:00
parent a6cca54647
commit 8c30051bdc

View file

@ -42,7 +42,8 @@ describe('Navigation', () => {
const navWrapper = getNavigationWrapper(props);
const navInstance = navWrapper.instance();
navWrapper.find('a.registrationLink').simulate('click');
// simulate click, with mocked event
navWrapper.find('a.registrationLink').simulate('click', {preventDefault () {}});
expect(navInstance.props.handleRegistrationRequested).toHaveBeenCalled();
});
@ -64,7 +65,7 @@ describe('Navigation', () => {
const navWrapper = getNavigationWrapper(props);
const navInstance = navWrapper.instance();
navWrapper.find('a.registrationLink').simulate('click');
navWrapper.find('a.registrationLink').simulate('click', {preventDefault () {}});
expect(navInstance.props.handleRegistrationRequested).toHaveBeenCalled();
});
});