Skip to content

Commit dc9dc49

Browse files
committed
fix pr using hard coded project id
1 parent ea467db commit dc9dc49

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/tests/ResultTest.test.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ describe("Results cases", () => {
8181
expect(cxCommandOutput.payload.length).toBeGreaterThan(0);
8282
});
8383

84+
// The project ID is hardcoded because there is no dynamic way to associate
85+
// an application with a project through the CLI.
8486
it("Risk Management - Successful case", async () => {
8587
const auth = new CxWrapper(cxScanConfig);
86-
const projectId = await getProjectId(auth);
88+
const projectId = "18bcbafc-d20e-424b-9c7e-8f007f340dee"
8789

8890
const cxCommandOutput: CxCommandOutput = await auth.riskManagementResults(
8991
projectId
@@ -94,9 +96,12 @@ describe("Results cases", () => {
9496
expect(cxCommandOutput.payload.length).toBeGreaterThan(0);
9597
});
9698

99+
100+
// The project ID is hardcoded because there is no dynamic way to associate
101+
// an application with a project through the CLI.
97102
it("Risk Management - With Limit", async () => {
98103
const auth = new CxWrapper(cxScanConfig);
99-
const projectId = await getProjectId(auth);
104+
const projectId = "18bcbafc-d20e-424b-9c7e-8f007f340dee"
100105
const cxCommandOutput: CxCommandOutput = await auth.riskManagementResults(
101106
projectId,
102107
10
@@ -111,18 +116,6 @@ describe("Results cases", () => {
111116
});
112117
});
113118

114-
const getProjectId = async (auth: CxWrapper): Promise<string> => {
115-
const scanList: CxCommandOutput = await auth.scanList("statuses=Completed");
116-
if (!scanList.payload.length) {
117-
throw new Error("No completed scans found.");
118-
}
119-
const scan = scanList.payload.find((scan) => scan.projectID);
120-
if (!scan) {
121-
throw new Error("No valid projectId found.");
122-
}
123-
return scan.projectID;
124-
};
125-
126119

127120
const fileExists = (file: string) => {
128121
return new Promise((resolve) => {

0 commit comments

Comments
 (0)