Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add test for existing automationDetails
David Verdeguer committed Apr 19, 2021

Unverified

No user is associated with the committer email.
1 parent 0ece0d0 commit 351d36f
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
@@ -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 =
@@ -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.