Skip to content

Commit

Permalink
in the case of automocking, assign spy.mockRevert to spy.mockRestore
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordfirespeed committed Aug 21, 2024
1 parent 4705cf3 commit d8566d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/mocker/src/automocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function mockObject(
const original = this[key]
const mock = spyOn(this, key as string)
.mockImplementation(original)
mock.mockRestore = () => {
mock.mockRevert = mock.mockRestore = () => {
mock.mockReset()
mock.mockImplementation(original)
return mock
Expand All @@ -132,7 +132,7 @@ export function mockObject(
const mock = spyOn(newContainer, property)
if (options.type === 'automock') {
mock.mockImplementation(mockFunction)
mock.mockRestore = () => {
mock.mockRevert = mock.mockRestore = () => {
mock.mockReset()
mock.mockImplementation(mockFunction)
return mock
Expand Down

0 comments on commit d8566d8

Please sign in to comment.