Skip to content

Commit d8566d8

Browse files
committed
in the case of automocking, assign spy.mockRevert to spy.mockRestore
1 parent 4705cf3 commit d8566d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/mocker/src/automocker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export function mockObject(
120120
const original = this[key]
121121
const mock = spyOn(this, key as string)
122122
.mockImplementation(original)
123-
mock.mockRestore = () => {
123+
mock.mockRevert = mock.mockRestore = () => {
124124
mock.mockReset()
125125
mock.mockImplementation(original)
126126
return mock
@@ -132,7 +132,7 @@ export function mockObject(
132132
const mock = spyOn(newContainer, property)
133133
if (options.type === 'automock') {
134134
mock.mockImplementation(mockFunction)
135-
mock.mockRestore = () => {
135+
mock.mockRevert = mock.mockRestore = () => {
136136
mock.mockReset()
137137
mock.mockImplementation(mockFunction)
138138
return mock

0 commit comments

Comments
 (0)