From 4760897243f7f4ffd1a37adceb8e336ccf5f7b75 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 4 Feb 2026 00:29:08 -0800 Subject: [PATCH] refactor: make test resets more explicit --- test/index.spec.js | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/test/index.spec.js b/test/index.spec.js index 9fa55e6..8e60110 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -89,29 +89,25 @@ export class Mock { * Testing interface that removes internal state from existing mocks. */ reset() { - // Clear lookup tables - this.inputs = {}; - this.booleanInputs = {}; - - // Reset axios mock + this._isDebug = false; this.axios.post.mock.resetCalls(); this.axios.post._promise = undefined; - - // Reset apiCall mock + this.booleanInputs = {}; this.calls.mock.resetCalls(); this.calls._resolvesWith = undefined; this.calls._rejectsWith = undefined; - - // Reset core mocks - for (const fn of Object.values(this.core)) { - fn.mock?.resetCalls(); - } - this._isDebug = false; - - // Reset webapi + this.core.debug.mock.resetCalls(); + this.core.error.mock.resetCalls(); + this.core.getBooleanInput.mock.resetCalls(); + this.core.getInput.mock.resetCalls(); + this.core.info.mock.resetCalls(); + this.core.isDebug.mock.resetCalls(); + this.core.setFailed.mock.resetCalls(); + this.core.setOutput.mock.resetCalls(); + this.core.setSecret.mock.resetCalls(); + this.core.warning.mock.resetCalls(); + this.inputs = {}; this.webapi = {}; - - // Clear environment variables process.env.SLACK_TOKEN = ""; process.env.SLACK_WEBHOOK_URL = ""; }