Skip to content

Commit

Permalink
Add test for existing automationDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
David Verdeguer committed Apr 19, 2021
1 parent 0ece0d0 commit 351d36f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/upload-lib.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/upload-lib.test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion src/upload-lib.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ test("finding SARIF files", async (t) => {
});

test("populateRunAutomationDetails", (t) => {
const sarif = '{"runs": [{}]}';
let sarif = '{"runs": [{}]}';
const analysisKey = ".github/workflows/codeql-analysis.yml:analyze";

let expectedSarif =
Expand Down Expand Up @@ -163,4 +163,14 @@ test("populateRunAutomationDetails", (t) => {
"{}"
);
t.deepEqual(modifiedSarif, expectedSarif);

// check that an empty environment produces the right results
sarif = '{"runs":[{"automationDetails":{"id":"my_id"}}]}';
expectedSarif = '{"runs":[{"automationDetails":{"id":"my_id"}}]}';
modifiedSarif = uploadLib.populateRunAutomationDetails(
sarif,
analysisKey,
'{"os": "linux", "language": "javascript"}'
);
t.deepEqual(modifiedSarif, expectedSarif);
});

0 comments on commit 351d36f

Please sign in to comment.