Skip to content

Commit 4922837

Browse files
update predicate test (#76)
* update predicate test * update logo
1 parent 26e2c2d commit 4922837

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
CX_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET}}
2020
CX_BASE_URI: ${{ secrets.BASE_URI }}
2121
CX_TENANT: ${{ secrets.TENANT }}
22+
CX_SCANID: ${{ secrets.SCANID }}
2223
run: npm test
2324
cx-scan:
2425
runs-on: ubuntu-latest

logo.png

8.69 KB
Loading

src/tests/BaseTest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export class BaseTest {
44
clientId: string = "";
55
clientSecret: string = "";
66
apiKey: string = "";
7+
scanId: string = "";
78
pathToExecutable: string;
89
tenant: string;
910

@@ -14,6 +15,7 @@ export class BaseTest {
1415
this.clientSecret = process.env["CX_CLIENT_SECRET"];
1516
this.tenant = process.env["CX_TENANT"];
1617
this.apiKey = process.env["CX_APIKEY"];
18+
this.scanId = process.env["CX_SCANID"];
1719
if (process.env["PATH_TO_EXECUTABLE"] !== null && process.env["PATH_TO_EXECUTABLE"] !== undefined) {
1820
this.pathToExecutable = process.env["PATH_TO_EXECUTABLE"];
1921
}

src/tests/PredicateTest.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ import {CxWrapper} from '../main/wrapper/CxWrapper';
22
import {CxCommandOutput} from "../main/wrapper/CxCommandOutput";
33
import {BaseTest} from "./BaseTest";
44
import CxResult from '../main/results/CxResult';
5-
import CxScan from '../main/scan/CxScan';
65
import { CxConstants } from '../main/wrapper/CxConstants';
76

87
describe("Triage cases",() => {
98
let cxScanConfig = new BaseTest();
109

1110
it('TriageShow Successful case', async () => {
1211
const auth = new CxWrapper(cxScanConfig);
13-
const scanListOutput = await auth.scanList("statuses=Completed");
14-
const scan: CxScan = scanListOutput.payload[0]
15-
const results = await auth.getResultsList(scan.id)
12+
const scan = (await auth.scanShow(cxScanConfig.scanId)).payload.pop();
13+
const results = await auth.getResultsList(cxScanConfig.scanId)
1614
const result: CxResult = results.payload.find(res => res.type == CxConstants.SAST)
1715

1816
const cxCommandOutput: CxCommandOutput = await auth.triageShow(scan.projectID, result.similarityId, result.type);
@@ -22,9 +20,8 @@ describe("Triage cases",() => {
2220

2321
it('TriageUpdate Successful case', async () => {
2422
const auth = new CxWrapper(cxScanConfig);
25-
const scanListOutput = await auth.scanList("statuses=Completed");
26-
const scan: CxScan = scanListOutput.payload[0]
27-
const results = await auth.getResultsList(scan.id)
23+
const scan = (await auth.scanShow(cxScanConfig.scanId)).payload.pop();
24+
const results = await auth.getResultsList(cxScanConfig.scanId)
2825
const result: CxResult = results.payload.find(res => res.type == CxConstants.SAST)
2926

3027
const cxCommandOutput: CxCommandOutput = await auth.triageUpdate(scan.projectID, result.similarityId, result.type, CxConstants.STATE_CONFIRMED, "Edited via JavascriptWrapper", result.severity.toLowerCase() == "high" ? CxConstants.SEVERITY_MEDIUM : CxConstants.SEVERITY_HIGH);

0 commit comments

Comments
 (0)