How can we write the test to check defaultProps function in this case (
handleChange: () => {},handleBlur: () => {},handleSubmit: () => {}
) attached to dom and they are working correctly?
I know we can test function when we pass as props but looking for help to test default functions. Thanks,
import React from 'react';
import PropTypes from 'prop-types';
const LoginForm = ({
handleChange,
handleBlur,
handleSubmit,
}) => (
<form onSubmit={handleSubmit}>
<input
onChange={handleChange}
onBlur={handleBlur}
/>
<input
onChange={handleChange}
onBlur={handleBlur}
/>
<button type="submit">
Submit
</button>
</form>
);
const shape = { email: '', password: '', generic: '' };
LoginForm.propTypes = {
handleChange: PropTypes.func,
handleBlur: PropTypes.func,
handleSubmit: PropTypes.func,
};
LoginForm.defaultProps = {
handleChange: () => {},
handleBlur: () => {},
handleSubmit: () => {},
};
export default LoginForm;