Skip to content

Commit c70508c

Browse files
committed
fix integration tests, branch required
1 parent 6bfccc6 commit c70508c

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

src/main/wrapper/CxWrapper.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,18 @@ export class CxWrapper {
126126
return await exec.executeCommands(this.pathToExecutable, commands, CxConstants.SCAN_TYPE);
127127
}
128128

129-
async scanList(): Promise<CxCommandOutput> {
130-
const commands: string[] = [CxConstants.CMD_SCAN, CxConstants.SUB_CMD_LIST];
129+
async scanList(filters:string): Promise<CxCommandOutput> {
130+
const validated_filters = this.filterArguments(filters);
131+
const commands: string[] = [CxConstants.CMD_SCAN, "list"].concat(validated_filters);
131132
commands.push(...this.initializeCommands(true));
132133

133134
const exec = new ExecutionService();
134135
return await exec.executeCommands(this.pathToExecutable, commands, CxConstants.SCAN_TYPE);
135136
}
136137

137-
async projectList(): Promise<CxCommandOutput> {
138-
const commands: string[] = [CxConstants.CMD_PROJECT, CxConstants.SUB_CMD_LIST];
138+
async projectList(filters:string): Promise<CxCommandOutput> {
139+
const validated_filters = this.filterArguments(filters);
140+
const commands: string[] = [CxConstants.CMD_PROJECT, "list"].concat(validated_filters);
139141
commands.push(...this.initializeCommands(true));
140142

141143
const exec = new ExecutionService();
@@ -144,7 +146,7 @@ export class CxWrapper {
144146

145147
async projectBranches(projectId: string, filters: string): Promise<CxCommandOutput> {
146148
// Verify and add possible branch filter by name
147-
const validated_filters = this.filterArguments(filters)
149+
const validated_filters = this.filterArguments(CxConstants.BRANCH_NAME + filters)
148150
const commands: string[] = [CxConstants.CMD_PROJECT , CxConstants.SUB_CMD_BRANCHES, CxConstants.PROJECT_ID, projectId].concat(validated_filters);
149151
commands.push(...this.initializeCommands(false));
150152

@@ -207,7 +209,7 @@ export class CxWrapper {
207209
let r = [];
208210
if(filters.length>0){
209211
r.push(CxConstants.FILTER);
210-
r.push(CxConstants.BRANCH_NAME + filters);
212+
r.push(filters);
211213
}
212214
return r;
213215
}

src/tests/ProjectTest.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("ProjectList cases",() => {
88

99
it('ProjectList Successful case', async () => {
1010
const auth = new CxWrapper(cxScanConfig);
11-
const data = await auth.projectList();
11+
const data = await auth.projectList("");
1212
const cxCommandOutput: CxCommandOutput = data;
1313
expect(cxCommandOutput.payload.length).toBeGreaterThan(0);
1414
});

src/tests/ResultTest.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("Results cases",() => {
88
let cxScanConfig = new BaseTest();
99
it('Result Test Successful case', async () => {
1010
const auth = new CxWrapper(cxScanConfig);
11-
const data = await auth.scanList();
11+
const data = await auth.scanList("");
1212
const cxCommandOutput: CxCommandOutput = data
1313
let sampleId = cxCommandOutput.payload.pop().ID;
1414
await auth.getResults(sampleId,"json","jsonList", ".")
@@ -18,7 +18,7 @@ describe("Results cases",() => {
1818

1919
it('Result List Successful case', async () => {
2020
const auth = new CxWrapper(cxScanConfig);
21-
const data = await auth.scanList();
21+
const data = await auth.scanList("");
2222
const cxCommandOutput: CxCommandOutput = data
2323
let sampleId = cxCommandOutput.payload.pop().ID;
2424
const written = await auth.getResultsList(sampleId)
@@ -27,7 +27,7 @@ describe("Results cases",() => {
2727

2828
it('Result summary html file generation successful case', async () => {
2929
const auth = new CxWrapper(cxScanConfig);
30-
const data = await auth.scanList();
30+
const data = await auth.scanList("");
3131
const cxCommandOutput: CxCommandOutput = data
3232
let sampleId = cxCommandOutput.payload.pop().ID;
3333
await auth.getResults(sampleId,"summaryHTML","test", ".")
@@ -37,7 +37,7 @@ describe("Results cases",() => {
3737

3838
it('Result summary html string successful case', async () => {
3939
const auth = new CxWrapper(cxScanConfig);
40-
const data = await auth.scanList();
40+
const data = await auth.scanList("");
4141
const cxCommandOutput: CxCommandOutput = data
4242
let sampleId = cxCommandOutput.payload.pop().ID;
4343
const written = await auth.getResultsSummary(sampleId)

src/tests/ScanTest.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe("ScanCreate cases",() => {
7676

7777
it('ScanList Successful case', async () => {
7878
const auth = new CxWrapper(cxScanConfig);
79-
const data = await auth.scanList();
79+
const data = await auth.scanList("");
8080
const cxCommandOutput: CxCommandOutput = data;
8181
expect(cxCommandOutput.payload.length).toBeGreaterThan(0);
8282
});

0 commit comments

Comments
 (0)