Skip to content

Commit 351d36f

Browse files
committed
Add test for existing automationDetails
1 parent 0ece0d0 commit 351d36f

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

lib/upload-lib.test.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/upload-lib.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/upload-lib.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ test("finding SARIF files", async (t) => {
133133
});
134134

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

139139
let expectedSarif =
@@ -163,4 +163,14 @@ test("populateRunAutomationDetails", (t) => {
163163
"{}"
164164
);
165165
t.deepEqual(modifiedSarif, expectedSarif);
166+
167+
// check that an empty environment produces the right results
168+
sarif = '{"runs":[{"automationDetails":{"id":"my_id"}}]}';
169+
expectedSarif = '{"runs":[{"automationDetails":{"id":"my_id"}}]}';
170+
modifiedSarif = uploadLib.populateRunAutomationDetails(
171+
sarif,
172+
analysisKey,
173+
'{"os": "linux", "language": "javascript"}'
174+
);
175+
t.deepEqual(modifiedSarif, expectedSarif);
166176
});

0 commit comments

Comments
 (0)