17
loading...
This website collects cookies to deliver better user experience
// ComponentWithCustomHook.test.jsx
jest.mock("./hooks", () => ({
useCustomHook: () => { customString: "some-string", customCallback: jest.fn() },
}))
hooks
module and overwriting it with our implementation in the test environment. In this case, we replace the useCustomHook
export with an anonymous function that returns some dummy values. Whenever the custom hook is now called inside our tests, it will always return the dummy values that we provided.