I have a mock, and I have setup a call.
const mock = jest.fn();
when(mock).calledWith("hello").mockResolvedValue("world");
I then need to implement "Once" style calls, overriding the function.
mock.mockReset();
when(mock).calledWith("hello").mockResolvedValueOnce("world");
when(mock).calledWith("hello").mockResolvedValueOnce("example");
Unfortunately, this clears all existing when mocks. Ideally, I could do this, which would clear any mocks for this specific set of arguments.
when(mock).calledWith("hello").mockReset()
It could then be chained something like this:
when(mock).calledWith("hello").mockResolvedValue("world");
when(mock)
.calledWith("hello")
.mockReset()
.mockResolvedValueOnce("example");
I have a mock, and I have setup a call.
I then need to implement "Once" style calls, overriding the function.
Unfortunately, this clears all existing when mocks. Ideally, I could do this, which would clear any mocks for this specific set of arguments.
It could then be chained something like this: