Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrompflopes committed Nov 29, 2023
1 parent ab55a25 commit a857113
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
11 changes: 9 additions & 2 deletions src/tests/PredicateTest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ describe("Triage cases", () => {
const scanList: CxCommandOutput = await auth.scanList("statuses=Completed");
const scan = scanList.payload.pop();

const results = await auth.getResultsList(scan.id)
const result: CxResult = results.payload.find(res => res.type == CxConstants.SAST)
let output;
while (!output) {
output = await auth.getResultsList(scanList.payload.pop().id)
if (output.status == "Error in the json file.") {
output = undefined;
}
}

const result: CxResult = output.payload.find(res => res.type == CxConstants.SAST)

const cxShow: CxCommandOutput = await auth.triageShow(scan.projectID, result.similarityId, result.type);

Expand Down
14 changes: 9 additions & 5 deletions src/tests/ResultTest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ describe("Results cases",() => {
it('Result List Successful case', async () => {
const auth = new CxWrapper(cxScanConfig);
const cxCommandOutput: CxCommandOutput = await auth.scanList("statuses=Completed");
console.log(JSON.stringify(cxCommandOutput));
const sampleId = cxCommandOutput.payload.pop().id;
const written = await auth.getResultsList(sampleId);
expect(written.status).toBeUndefined();
expect(written.payload.length).toBeGreaterThanOrEqual(0);
let output;
while (!output) {
output = await auth.getResultsList(cxCommandOutput.payload.pop().id)
if (output.status == "Error in the json file.") {
output = undefined;
}
}
expect(output.status).toBeUndefined();
expect(output.payload.length).toBeGreaterThanOrEqual(0);
});

it('Result summary html file generation successful case', async () => {
Expand Down

0 comments on commit a857113

Please sign in to comment.