I am mocking my mutation with this. But it gives me TypeError: startSession.mutate is not a function
<div className="menu">
<Button
onClick={() => startSession.mutate(clientId)}>
Start Session
</Button>
</div>
describe('<ChatSessionTimer />', () => {
const startSession = jest.fn()
it('calls startSession on button click', async () => {
const wrapper = mount(<ChatSession customerId="12234" />)
wrapper.find('Button').find('a.button').at(0).simulate('click')
expect(startSession).toHaveBeenCalled()
})
})
How can I make this work? Thanks a lot.