I make a simple demo of counter I am using jest and enzyme for testing.I want to know if I click increment button it call increment button handler. but it is giving me this error
useCounter" is read-only.
here is my code https://codesandbox.io/s/awesome-jepsen-5os4e?file=/src/App.test.js
test("clicking button increment counter i call increment function", () => {
const f1 = jest.fn();
useCounter = jest.fn(() => {
return {
state: "",
increment: f1,
decrement: null
};
});
const wrapper = setup();
// find button and click
const button = findByTestAttr(wrapper, "increment-button");
button.simulate("click");
// find display and test value
expect(f1).toHaveBeenCalled();
});
