Skip to content

Commit 4760897

Browse files
committed
refactor: make test resets more explicit
1 parent c0f4382 commit 4760897

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

test/index.spec.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,29 +89,25 @@ export class Mock {
8989
* Testing interface that removes internal state from existing mocks.
9090
*/
9191
reset() {
92-
// Clear lookup tables
93-
this.inputs = {};
94-
this.booleanInputs = {};
95-
96-
// Reset axios mock
92+
this._isDebug = false;
9793
this.axios.post.mock.resetCalls();
9894
this.axios.post._promise = undefined;
99-
100-
// Reset apiCall mock
95+
this.booleanInputs = {};
10196
this.calls.mock.resetCalls();
10297
this.calls._resolvesWith = undefined;
10398
this.calls._rejectsWith = undefined;
104-
105-
// Reset core mocks
106-
for (const fn of Object.values(this.core)) {
107-
fn.mock?.resetCalls();
108-
}
109-
this._isDebug = false;
110-
111-
// Reset webapi
99+
this.core.debug.mock.resetCalls();
100+
this.core.error.mock.resetCalls();
101+
this.core.getBooleanInput.mock.resetCalls();
102+
this.core.getInput.mock.resetCalls();
103+
this.core.info.mock.resetCalls();
104+
this.core.isDebug.mock.resetCalls();
105+
this.core.setFailed.mock.resetCalls();
106+
this.core.setOutput.mock.resetCalls();
107+
this.core.setSecret.mock.resetCalls();
108+
this.core.warning.mock.resetCalls();
109+
this.inputs = {};
112110
this.webapi = {};
113-
114-
// Clear environment variables
115111
process.env.SLACK_TOKEN = "";
116112
process.env.SLACK_WEBHOOK_URL = "";
117113
}

0 commit comments

Comments
 (0)