refactor: make test resets more explicit
This commit is contained in:
+13
-17
@@ -89,29 +89,25 @@ export class Mock {
|
|||||||
* Testing interface that removes internal state from existing mocks.
|
* Testing interface that removes internal state from existing mocks.
|
||||||
*/
|
*/
|
||||||
reset() {
|
reset() {
|
||||||
// Clear lookup tables
|
this._isDebug = false;
|
||||||
this.inputs = {};
|
|
||||||
this.booleanInputs = {};
|
|
||||||
|
|
||||||
// Reset axios mock
|
|
||||||
this.axios.post.mock.resetCalls();
|
this.axios.post.mock.resetCalls();
|
||||||
this.axios.post._promise = undefined;
|
this.axios.post._promise = undefined;
|
||||||
|
this.booleanInputs = {};
|
||||||
// Reset apiCall mock
|
|
||||||
this.calls.mock.resetCalls();
|
this.calls.mock.resetCalls();
|
||||||
this.calls._resolvesWith = undefined;
|
this.calls._resolvesWith = undefined;
|
||||||
this.calls._rejectsWith = undefined;
|
this.calls._rejectsWith = undefined;
|
||||||
|
this.core.debug.mock.resetCalls();
|
||||||
// Reset core mocks
|
this.core.error.mock.resetCalls();
|
||||||
for (const fn of Object.values(this.core)) {
|
this.core.getBooleanInput.mock.resetCalls();
|
||||||
fn.mock?.resetCalls();
|
this.core.getInput.mock.resetCalls();
|
||||||
}
|
this.core.info.mock.resetCalls();
|
||||||
this._isDebug = false;
|
this.core.isDebug.mock.resetCalls();
|
||||||
|
this.core.setFailed.mock.resetCalls();
|
||||||
// Reset webapi
|
this.core.setOutput.mock.resetCalls();
|
||||||
|
this.core.setSecret.mock.resetCalls();
|
||||||
|
this.core.warning.mock.resetCalls();
|
||||||
|
this.inputs = {};
|
||||||
this.webapi = {};
|
this.webapi = {};
|
||||||
|
|
||||||
// Clear environment variables
|
|
||||||
process.env.SLACK_TOKEN = "";
|
process.env.SLACK_TOKEN = "";
|
||||||
process.env.SLACK_WEBHOOK_URL = "";
|
process.env.SLACK_WEBHOOK_URL = "";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user