From 8e98b9ef02851edcccdc4a9b54073dc7bf80e073 Mon Sep 17 00:00:00 2001 From: wafuwafu13 Date: Mon, 22 Aug 2022 12:59:52 +0900 Subject: [PATCH] feat: Implement stub.resetBehavior() and stub.resetHistory() --- src/transformers/sinon.test.ts | 4 ++++ src/transformers/sinon.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/transformers/sinon.test.ts b/src/transformers/sinon.test.ts index 5b778d98..5fddb526 100644 --- a/src/transformers/sinon.test.ts +++ b/src/transformers/sinon.test.ts @@ -379,12 +379,16 @@ describe('mocks', () => { Api.get.restore() Api.get.reset() sinon.restore() + stub.resetBehavior() + stub.resetHistory() `, ` stub.mockRestore() Api.get.mockRestore() Api.get.mockReset() jest.restoreAllMocks() + stub.mockReset() + stub.mockReset() ` ) }) diff --git a/src/transformers/sinon.ts b/src/transformers/sinon.ts index 67929fee..fccb71e6 100644 --- a/src/transformers/sinon.ts +++ b/src/transformers/sinon.ts @@ -35,6 +35,8 @@ const SINON_CALLED_WITH_METHODS = ['calledWith', 'notCalledWith'] const SINON_SPY_METHODS = ['spy', 'stub'] const SINON_MOCK_RESETS = { reset: 'mockReset', + resetBehavior: 'mockReset', + resetHistory: 'mockReset', restore: 'mockRestore', } const SINON_MATCHERS = {