Remove redundant layer from upload files functions

This commit is contained in:
Henry Mercer 2024-07-01 13:51:14 +02:00
parent 79e9a50e51
commit 6c2a71ced3
15 changed files with 54 additions and 80 deletions

View file

@ -319,8 +319,8 @@ async function testFailedSarifUpload(t, actionsWorkflow, { category, databaseExi
const databaseExportDiagnosticsStub = sinon.stub(codeqlObject, "databaseExportDiagnostics");
const diagnosticsExportStub = sinon.stub(codeqlObject, "diagnosticsExport");
sinon.stub(workflow, "getWorkflow").resolves(actionsWorkflow);
const uploadFromActions = sinon.stub(uploadLib, "uploadFromActions");
uploadFromActions.resolves({
const uploadFiles = sinon.stub(uploadLib, "uploadFiles");
uploadFiles.resolves({
sarifID: "42",
statusReport: { raw_upload_size_bytes: 20, zipped_upload_size_bytes: 10 },
});
@ -342,14 +342,14 @@ async function testFailedSarifUpload(t, actionsWorkflow, { category, databaseExi
else {
t.true(diagnosticsExportStub.calledOnceWith(sinon.match.string, category, config), `Actual args were: ${diagnosticsExportStub.args}`);
}
t.true(uploadFromActions.calledOnceWith(sinon.match.string, sinon.match.string, category, sinon.match.any), `Actual args were: ${uploadFromActions.args}`);
t.true(uploadFiles.calledOnceWith(sinon.match.string, sinon.match.string, category, sinon.match.any), `Actual args were: ${uploadFiles.args}`);
t.true(waitForProcessing.calledOnceWith(sinon.match.any, "42", sinon.match.any, {
isUnsuccessfulExecution: true,
}));
}
else {
t.true(diagnosticsExportStub.notCalled);
t.true(uploadFromActions.notCalled);
t.true(uploadFiles.notCalled);
t.true(waitForProcessing.notCalled);
}
return result;