Skip to content

Commit d4a8504

Browse files
updated test cases
1 parent 64580b9 commit d4a8504

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/tests/PredicateTest.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,40 @@ describe("Triage cases", () => {
7070
await handleTriageSCAUpdate(projectId, vulnerabilities, scanType, state, comment);
7171
});
7272

73+
it('SCA Triage Show and Update Failure case', async () => {
74+
const projectId = "invalid-project-id";
75+
const vulnerabilities = "invalid-vulnerability-string";
76+
const scanType = "invalid";
77+
const state = "invalid_state";
78+
const comment = "invalid_comment";
79+
80+
const cxShow: CxCommandOutput = await auth.triageSCAShow(projectId, vulnerabilities, scanType);
81+
expect(cxShow.exitCode).not.toEqual(0);
82+
83+
const cxUpdate: CxCommandOutput = await auth.triageSCAUpdate(projectId, vulnerabilities, scanType, state, comment);
84+
expect(cxUpdate.exitCode).not.toEqual(0);
85+
});
86+
87+
it('SCA Triage Show and Update with empty vulnerabilities', async () => {
88+
const projectId = "d4d7f382-8dee-48c7-ac8f-67fab2c313a8";
89+
const vulnerabilities = "";
90+
const scanType = "sca";
91+
const state = "To_verify";
92+
const comment = "comment1";
93+
const cxShow: CxCommandOutput = await auth.triageSCAShow(projectId, vulnerabilities, scanType);
94+
expect(cxShow.exitCode).not.toEqual(0);
95+
96+
const cxUpdate: CxCommandOutput = await auth.triageSCAUpdate(projectId, vulnerabilities, scanType, state, comment);
97+
expect(cxUpdate.exitCode).not.toEqual(0);
98+
});
99+
100+
it('SCA Triage Show and Update with null/undefined arguments', async () => {
101+
const cxShow: CxCommandOutput = await auth.triageSCAShow(undefined, undefined, undefined);
102+
expect(cxShow.exitCode).not.toEqual(0);
103+
const cxUpdate: CxCommandOutput = await auth.triageSCAUpdate(undefined, undefined, undefined, undefined, undefined);
104+
expect(cxUpdate.exitCode).not.toEqual(0);
105+
});
106+
73107
it('Triage Successful case', async () => {
74108
const { scan, result } = await getScanAndResult();
75109
await handleTriageShow(scan, result);

0 commit comments

Comments
 (0)