Jest: Cannot read property 'split' of undefined Unit testing React

Created on 12 Sep 2018  路  1Comment  路  Source: facebook/jest

this is my testing code

it('sets state openModal when form submitted', () => {
const actions = {
postData: jest.fn(),
};
const data = {
firstName: 'Test',
birthDate: 'tes',
email: '[email protected]',
phoneNumber: '0823',
province: 'A',
subdistrict: 'test',
}
const wrapper = shallow();
wrapper.find('#registerForm').simulate('submit');
expect(wrapper.state('openModal')).toEqual(true);
expect(actions.postData).toHaveBeenCalled();
});

but error like this
TypeError: Cannot read property 'split' of undefined

>All comments

Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions

Was this page helpful?
0 / 5 - 0 ratings