Categories
Mastering Development

Testing useDispach with jest

I’m trying to test useDispach using jest. This is my component ItemInput.js: const ItemInput = ({ value, title, action, type, placeholder }) => { const dispatch = useDispatch(); return ( <div> <span data-cy=”title”>{title}</span> <Input type={type} value={value} onChange={e => dispatch({ type: action, payload: { value: e.target.value } }) } placeholder={placeholder} data-cy={`item-input-${title}`} /> </div> );}; and here […]