@@ -5,13 +5,17 @@ import {BaseTest} from "./BaseTest";
55
66describe ( "ScanCreate cases" , ( ) => {
77 let cxScanConfig = new BaseTest ( ) ;
8+ it ( 'ScanList Successful case' , async ( ) => {
9+ const auth = new CxWrapper ( cxScanConfig ) ;
10+ const cxCommandOutput : CxCommandOutput = await auth . scanList ( "" ) ;
11+ expect ( cxCommandOutput . payload . length ) . toBeGreaterThan ( 0 ) ;
12+ } ) ;
813 it ( 'ScanCreate Successful case wait mode' , async ( ) => {
914 const params = new Map ( ) ;
1015 params . set ( CxParamType . PROJECT_NAME , "ast-cli-javascript-integration-success" ) ;
1116 params . set ( CxParamType . S , "./src" ) ;
1217 params . set ( CxParamType . FILTER , "*.ts,!**/node_modules/**/*" ) ;
1318 params . set ( CxParamType . BRANCH , "master" ) ;
14-
1519 const auth = new CxWrapper ( cxScanConfig ) ;
1620 const data = await auth . scanCreate ( params ) ;
1721 const cxCommandOutput : CxCommandOutput = data ;
@@ -21,39 +25,33 @@ describe("ScanCreate cases",() => {
2125 expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Completed" ) ;
2226 } )
2327
24- it ( 'ScanCreate Successful case with Branch ' , async ( ) => {
28+ it ( 'ScanCreate Failure case' , async ( ) => {
2529 const params = new Map ( ) ;
26- params . set ( CxParamType . PROJECT_NAME , "ast-cli-javascript-integration-success-branch " ) ;
30+ params . set ( CxParamType . PROJECT_NAME , "ast-cli-javascript-integration-failure " ) ;
2731 params . set ( CxParamType . S , "./src" ) ;
28- params . set ( CxParamType . FILTER , "*.ts,!**/node_modules/**/* " ) ;
32+ params . set ( CxParamType . SAST_PRESET_NAME , "Checkmarx Default Fake " ) ;
2933 params . set ( CxParamType . BRANCH , "master" ) ;
30-
3134 const auth = new CxWrapper ( cxScanConfig ) ;
32-
33- const data = await auth . scanCreate ( params ) ;
34- const cxCommandOutput : CxCommandOutput = data ;
35+ const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
3536 const scanObject = cxCommandOutput . payload . pop ( ) ;
3637 const scanShowObject = await auth . scanShow ( scanObject . ID ) ;
37- console . log ( " Json object from successful wait mode case with branch: " + JSON . stringify ( scanShowObject ) ) ;
38- expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Completed" ) ;
39-
38+ console . log ( " Json object from failure case: " + JSON . stringify ( scanShowObject ) ) ;
39+ expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Failed" ) ;
4040 } )
4141
42- it ( 'ScanCreate Failure case' , async ( ) => {
42+ it ( 'ScanCreate Successful case with Branch ' , async ( ) => {
4343 const params = new Map ( ) ;
44- params . set ( CxParamType . PROJECT_NAME , "ast-cli-javascript-integration-failure " ) ;
44+ params . set ( CxParamType . PROJECT_NAME , "ast-cli-javascript-integration-success-branch " ) ;
4545 params . set ( CxParamType . S , "./src" ) ;
46- params . set ( CxParamType . SAST_PRESET_NAME , "Checkmarx Default Fake " ) ;
46+ params . set ( CxParamType . FILTER , "*.ts,!**/node_modules/**/* " ) ;
4747 params . set ( CxParamType . BRANCH , "master" ) ;
48-
4948 const auth = new CxWrapper ( cxScanConfig ) ;
50-
51- const data = await auth . scanCreate ( params ) ;
52- const cxCommandOutput : CxCommandOutput = data ;
49+ const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
5350 const scanObject = cxCommandOutput . payload . pop ( ) ;
5451 const scanShowObject = await auth . scanShow ( scanObject . ID ) ;
55- console . log ( " Json object from failure case: " + JSON . stringify ( scanShowObject ) ) ;
56- expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Failed" ) ;
52+ console . log ( " Json object from successful wait mode case with branch: " + JSON . stringify ( scanShowObject ) ) ;
53+ expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Completed" ) ;
54+
5755 } )
5856
5957 it ( 'ScanCreate Successful case no wait mode' , async ( ) => {
@@ -63,21 +61,11 @@ describe("ScanCreate cases",() => {
6361 params . set ( CxParamType . SAST_PRESET_NAME , "Checkmarx Default Fake" ) ;
6462 params . set ( CxParamType . ADDITIONAL_PARAMETERS , "--async" ) ;
6563 params . set ( CxParamType . BRANCH , "master" ) ;
66-
6764 const auth = new CxWrapper ( cxScanConfig ) ;
68-
69- const data = await auth . scanCreate ( params ) ;
70- const cxCommandOutput : CxCommandOutput = data ;
65+ const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
7166 const scanObject = cxCommandOutput . payload . pop ( ) ;
7267 const scanShowObject = await auth . scanShow ( scanObject . ID ) ;
73- console . log ( " Json object from successful no wait mode case: " + JSON . stringify ( scanShowObject ) )
74- expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Running" )
68+ console . log ( " Json object from successful no wait mode case: " + JSON . stringify ( scanShowObject ) ) ;
69+ expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Running" ) ;
7570 } )
76-
77- it ( 'ScanList Successful case' , async ( ) => {
78- const auth = new CxWrapper ( cxScanConfig ) ;
79- const data = await auth . scanList ( "" ) ;
80- const cxCommandOutput : CxCommandOutput = data ;
81- expect ( cxCommandOutput . payload . length ) . toBeGreaterThan ( 0 ) ;
82- } ) ;
8371} ) ;
0 commit comments