Currently I have 2 test like this, the first one is ok, the second needs to overwrite some implementation:
import { useUtil } from "my-util";
jest.mock("my-util", () => {
return {
...jest.requireActual("my-util"),
};
});
describe("some", () => {
it("this works", () => {
// no need to mock anything because the requireActual comes with the default data that I need for this case
});
it("this doesn't work")
Here I need to overwrite the implementation of “my-util” which is a function that returns an object like this:
{
"func1": () => null,
"func2": () => baz
}
I need to overwrite the implementation of func2
, it should return "some string"
, but I can’t find a way to mock just func2
for the second it
case