score:1
i think it's because you have a html form, not just an arbitrary submit function. try identifying the form, eg. <form id='form'>
and testing it like so:
const form = wrapper.find('#form').at(0);
form.simulate('submit');
edit you can also try:
wrapper.update();
settimeout(function () {
expect(...).tobe(...);
done();
}, 500);
and don't forget to pass done
as your test case function's argument.
Source: stackoverflow.com
Related Query
- testing form validation using Enzyme
- Testing a component that uses useEffect using Enzyme shallow and not mount
- How to simulate mouse over event on a div using enzyme for testing a react application?
- Mocha, Enzyme: Unit testing custom functions in react component using enzyme
- Testing changes to React component state and spying on instance methods using enzyme
- Form Validation using Yup to check whether inputs value is equal or not
- Testing a Redux-connected component using Enzyme
- The validation errors are not showing using React Hook Form
- Unit test form submission with data using react testing library
- How to give validation in multi step form using react
- Support callback for changing another field value when using React Hook Form validation
- Testing useEffect unmount callback called using acts in enzyme
- React material UI form validation using error and helperText
- Testing JSX inside .map function using Enzyme
- Form Validation not working using react and StepWizard
- Form validation using Meteor/React/SimpleSchema
- yup form validation with formik using regex not working as expected with bangla font input field
- File input validation using React Hook Form and Yup
- Error when testing a React Parent that contains a Child React Redux Component using Enzyme Mount
- Testing handle change function in React using Enzyme and Jest
- how to test button that call submit form using jest and react testing library
- React Hook Form using Controller, yup and Material UI - validation issue
- Testing react component using rxjs library with enzyme
- Testing Higher Order Components using jest and enzyme
- How to show validation errors on form using React
- Form validation using regex is not working TextField MUI React
- Using array of error messages per one validation rule in react hook form
- Form Validation Logic Problem ( Using React useState Hook)
- Form validation using Spy by Sinon gets wrong
- React. Fromik. Material-ui form submit event testing fails using react-testing-library
More Query from same tag
- material UI grid layout design
- Update component when props update
- React app gets slow renders slow after emitting socketio message
- Prerender images from URL in reactjs
- Create element / resource with dynamic fields in react admin
- Transmit default function parameters with Babel
- ReactJS - Can't import component
- ES6 Fat arrow in react this.setState ESLint error
- How to simplify JavaScript/React
- React context state sharing not working in sibling components
- How can I load user every time the page is refreshed?
- React.js Toggling Display
- Complex conditional rendering
- Set Redux State in handleSubmit method of Formik React form
- React SignalR - Do not send bearer token in URL
- Axios request to .net controller gives value of none
- React/Next js, set active class on a button based on index
- Using React with Nashorn throws "ReferenceError: "console" is not defined"
- What are the benefits of immutability?
- React - Using Props outside of Render
- ES6+React, Error:React.createElement: type should not be null, undefined, boolean, or number
- Troubleshooting memo call React+Typescript
- Combine two filter rules for an array of objects
- React props state syncing causes unnecessary first re-render
- Reverse default Route to private Route and conversely
- How to get dates between two dates using d3-scale time
- Get id from one form out of multiple forms? (React)
- Dynamic add MediaStream's into current.srcObject into a list of useRef for <video> [React]
- Handle checkboxes with useState object
- React Pass the ID of clicked Element to another Component