Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagobcx committed Nov 11, 2021
1 parent 234056f commit 822e9af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/tests/ResultTest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {BaseTest} from "./BaseTest";
import * as fs from "fs";

describe("Results cases",() => {
const cxScanConfig = new BaseTest();
let cxScanConfig = new BaseTest();
it('Result Test Successful case', async () => {
const auth = new CxWrapper(cxScanConfig);
const cxCommandOutput: CxCommandOutput = await auth.scanList("");
Expand Down
34 changes: 17 additions & 17 deletions src/tests/ScanTest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import {BaseTest} from "./BaseTest";
describe("ScanCreate cases",() => {
let cxScanConfig = new BaseTest();

it('ScanList Successful case', async () => {
const auth = new CxWrapper(cxScanConfig);
const cxCommandOutput: CxCommandOutput = await auth.scanList("");
expect(cxCommandOutput.payload.length).toBeGreaterThan(0);
});

it('ScanCreate Successful case wait mode', async () => {
const params = new Map();
params.set(CxParamType.PROJECT_NAME, "ast-cli-javascript-integration-success");
Expand All @@ -26,33 +20,39 @@ describe("ScanCreate cases",() => {
expect(scanShowObject.payload.pop().Status).toEqual("Completed");
})

it('ScanCreate Successful case with Branch', async () => {
it('ScanCreate Failure case', async () => {
const params = new Map();
params.set(CxParamType.PROJECT_NAME, "ast-cli-javascript-integration-success-branch");
params.set(CxParamType.PROJECT_NAME, "ast-cli-javascript-integration-failure");
params.set(CxParamType.S, "./src");
params.set(CxParamType.FILTER, "*.ts,!**/node_modules/**/*");
params.set(CxParamType.SAST_PRESET_NAME, "Checkmarx Default Fake");
params.set(CxParamType.BRANCH, "master");
const auth = new CxWrapper(cxScanConfig);
const cxCommandOutput: CxCommandOutput = await auth.scanCreate(params);
const scanObject = cxCommandOutput.payload.pop();
const scanShowObject = await auth.scanShow(scanObject.ID);
console.log(" Json object from successful wait mode case with branch: " +JSON.stringify(scanShowObject));
expect(scanShowObject.payload.pop().Status).toEqual("Completed");

console.log(" Json object from failure case: " + JSON.stringify(scanShowObject));
expect(scanShowObject.payload.pop().Status).toEqual("Failed");
})

it('ScanCreate Failure case', async () => {
it('ScanList Successful case', async () => {
const auth = new CxWrapper(cxScanConfig);
const cxCommandOutput: CxCommandOutput = await auth.scanList("");
expect(cxCommandOutput.payload.length).toBeGreaterThan(0);
});

it('ScanCreate Successful case with Branch', async () => {
const params = new Map();
params.set(CxParamType.PROJECT_NAME, "ast-cli-javascript-integration-failure");
params.set(CxParamType.PROJECT_NAME, "ast-cli-javascript-integration-success-branch");
params.set(CxParamType.S, "./src");
params.set(CxParamType.SAST_PRESET_NAME, "Checkmarx Default Fake");
params.set(CxParamType.FILTER, "*.ts,!**/node_modules/**/*");
params.set(CxParamType.BRANCH, "master");
const auth = new CxWrapper(cxScanConfig);
const cxCommandOutput: CxCommandOutput = await auth.scanCreate(params);
const scanObject = cxCommandOutput.payload.pop();
const scanShowObject = await auth.scanShow(scanObject.ID);
console.log(" Json object from failure case: " + JSON.stringify(scanShowObject));
expect(scanShowObject.payload.pop().Status).toEqual("Failed");
console.log(" Json object from successful wait mode case with branch: " +JSON.stringify(scanShowObject));
expect(scanShowObject.payload.pop().Status).toEqual("Completed");

})

it('ScanCreate Successful case no wait mode', async () => {
Expand Down

0 comments on commit 822e9af

Please sign in to comment.