Skip to content

Commit 1a64a55

Browse files
Change State ID to int(AST-81677) (#804)
* Add get state func and add state id for triage update. add tests * Skip on custom state tests. * Add --all flag * State id is optional * Change State id to int * Change State id to int --------- Co-authored-by: galactica <[email protected]>
1 parent 027e3cb commit 1a64a55

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/wrapper/CxWrapper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ export class CxWrapper {
200200
return await exec.executeCommands(this.config.pathToExecutable, commands, CxConstants.PREDICATE_TYPE);
201201
}
202202

203-
async triageUpdate(projectId: string, similarityId: string, scanType: string, state: string, comment: string, severity: string, stateId = ""): Promise<CxCommandOutput> {
203+
async triageUpdate(projectId: string, similarityId: string, scanType: string, state: string, comment: string, severity: string, stateId:number|null = null): Promise<CxCommandOutput> {
204204
const commands: string[] = [CxConstants.CMD_TRIAGE, CxConstants.SUB_CMD_UPDATE, CxConstants.PROJECT_ID, projectId, CxConstants.SIMILARITY_ID, similarityId, CxConstants.SCAN_TYPES_SUB_CMD, scanType, CxConstants.STATE, state, CxConstants.COMMENT, comment, CxConstants.SEVERITY, severity];
205205
if(stateId) {
206206
commands.push(CxConstants.STATE_ID)
207-
commands.push(stateId)
207+
commands.push(stateId.toString())
208208
}
209209
commands.push(...this.initializeCommands(false));
210210
const exec = new ExecutionService();

src/tests/PredicateTest.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe("Triage cases", () => {
3131
expect(cxShow.exitCode).toEqual(0);
3232
}
3333

34-
const handleTriageUpdate = async (scan: any, result: CxResult, newState: string, newSeverity: string, newStateId = "") => {
34+
const handleTriageUpdate = async (scan: any, result: CxResult, newState: string, newSeverity: string, newStateId: number|null = null ) => {
3535
const cxUpdate: CxCommandOutput = await auth.triageUpdate(
3636
scan.projectID, result.similarityId, result.type, newState,
3737
"Edited via JavascriptWrapper",
@@ -87,6 +87,6 @@ describe("Triage cases", () => {
8787
await handleTriageUpdate(scan, result, CxConstants.STATE_CONFIRMED, CxConstants.SEVERITY_MEDIUM);
8888
}
8989
}
90-
await handleTriageUpdate(scan, result, "", CxConstants.SEVERITY_MEDIUM, customStateId.toString());
90+
await handleTriageUpdate(scan, result, "", CxConstants.SEVERITY_MEDIUM, customStateId);
9191
});
9292
});

0 commit comments

Comments
 (0)