Function | Clears Call History | Resets Implementations | Restores Original Implementation | Scope of Use |
---|---|---|---|---|
mockClear() |
✅ | ❌ | ❌ | Clear usage data of the mock function but keep its implementation and return values. |
mockReset() |
✅ | ✅ | ❌ | Reset the mock function to its initial state, removing any custom behavior or return values. |
mockRestore() |
✅ | ✅ | ✅ | Restore the original function, removing the mock (only applicable with jest.spyOn ). |
Created
November 5, 2023 09:11
-
-
Save mustafadalga/c1602df648b60b8758db9a74045a476d to your computer and use it in GitHub Desktop.
Summarizes the behavior of mockClear, mockReset, and mockRestore in Jest/Vitest
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment