From 736b61cde36a3db008c721138111c68aaddac992 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Wed, 29 Nov 2023 08:42:12 +0900 Subject: [PATCH] test: more check --- test/core/test/mocked-class-restore.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/core/test/mocked-class-restore.test.ts b/test/core/test/mocked-class-restore.test.ts index 24c7e189d38c..f2af585391e4 100644 --- a/test/core/test/mocked-class-restore.test.ts +++ b/test/core/test/mocked-class-restore.test.ts @@ -26,6 +26,21 @@ test(`mocked class method not restorable`, () => { // restoring instance method vi.mocked(instance1.testFn).mockRestore() + expect(vi.mocked(instance1.testFn).mock.calls).toMatchInlineSnapshot(` + [ + [ + "a", + ], + ] + `) + expect(vi.mocked(MockedE.prototype.testFn).mock.calls).toMatchInlineSnapshot(` + [ + [ + "a", + ], + ] + `) + expect(instance1.testFn('b')).toMatchInlineSnapshot(`undefined`) expect(vi.mocked(instance1.testFn).mock.calls).toMatchInlineSnapshot(` [ @@ -50,6 +65,9 @@ test(`mocked class method not restorable`, () => { // restoring prototype doesn't restore instance vi.mocked(MockedE.prototype.testFn).mockRestore() + expect(vi.mocked(instance1.testFn).mock.calls).toMatchInlineSnapshot(`[]`) + expect(vi.mocked(MockedE.prototype.testFn).mock.calls).toMatchInlineSnapshot(`[]`) + expect(instance1.testFn('c')).toMatchInlineSnapshot(`undefined`) expect(vi.mocked(instance1.testFn).mock.calls).toMatchInlineSnapshot(` [