@@ -4,80 +4,65 @@ import {CxParamType} from "../main/wrapper/CxParamType";
44import { BaseTest } from "./BaseTest" ;
55
66describe ( "ScanCreate cases" , ( ) => {
7- let cxScanConfig = new BaseTest ( ) ;
7+ let params = new Map ( ) ;
8+ const cxScanConfig = new BaseTest ( ) ;
89 it ( 'ScanCreate Successful case wait mode' , async ( ) => {
9- const params = new Map ( ) ;
1010 params . set ( CxParamType . PROJECT_NAME , "ast-cli-javascript-integration-success" ) ;
1111 params . set ( CxParamType . S , "./src" ) ;
1212 params . set ( CxParamType . FILTER , "*.ts,!**/node_modules/**/*" ) ;
1313 params . set ( CxParamType . BRANCH , "master" ) ;
14-
1514 const auth = new CxWrapper ( cxScanConfig ) ;
16- const data = await auth . scanCreate ( params ) ;
17- const cxCommandOutput : CxCommandOutput = data ;
18- const ScanObject = cxCommandOutput . payload . pop ( ) ;
19- const scanShowObject = await auth . scanShow ( ScanObject . ID ) ;
15+ const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
16+ const scanObject = cxCommandOutput . payload . pop ( ) ;
17+ const scanShowObject = await auth . scanShow ( scanObject . ID ) ;
2018 console . log ( " Json object from successful wait mode case: " + JSON . stringify ( scanShowObject ) ) ;
2119 expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Completed" ) ;
2220 } )
2321
2422 it ( 'ScanCreate Successful case with Branch' , async ( ) => {
25- const params = new Map ( ) ;
2623 params . set ( CxParamType . PROJECT_NAME , "ast-cli-javascript-integration-success-branch" ) ;
2724 params . set ( CxParamType . S , "./src" ) ;
2825 params . set ( CxParamType . FILTER , "*.ts,!**/node_modules/**/*" ) ;
2926 params . set ( CxParamType . BRANCH , "master" ) ;
30-
3127 const auth = new CxWrapper ( cxScanConfig ) ;
32-
33- const data = await auth . scanCreate ( params ) ;
34- const cxCommandOutput : CxCommandOutput = data ;
35- const ScanObject = cxCommandOutput . payload . pop ( ) ;
36- const scanShowObject = await auth . scanShow ( ScanObject . ID ) ;
28+ const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
29+ const scanObject = cxCommandOutput . payload . pop ( ) ;
30+ const scanShowObject = await auth . scanShow ( scanObject . ID ) ;
3731 console . log ( " Json object from successful wait mode case with branch: " + JSON . stringify ( scanShowObject ) ) ;
3832 expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Completed" ) ;
3933
4034 } )
4135
4236 it ( 'ScanCreate Failure case' , async ( ) => {
43- const params = new Map ( ) ;
4437 params . set ( CxParamType . PROJECT_NAME , "ast-cli-javascript-integration-failure" ) ;
4538 params . set ( CxParamType . S , "./src" ) ;
4639 params . set ( CxParamType . SAST_PRESET_NAME , "Checkmarx Default Fake" ) ;
4740 params . set ( CxParamType . BRANCH , "master" ) ;
48-
4941 const auth = new CxWrapper ( cxScanConfig ) ;
50-
51- const data = await auth . scanCreate ( params ) ;
52- const cxCommandOutput : CxCommandOutput = data ;
53- const ScanObject = cxCommandOutput . payload . pop ( ) ;
54- const scanShowObject = await auth . scanShow ( ScanObject . ID ) ;
42+ const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
43+ const scanObject = cxCommandOutput . payload . pop ( ) ;
44+ const scanShowObject = await auth . scanShow ( scanObject . ID ) ;
5545 console . log ( " Json object from failure case: " + JSON . stringify ( scanShowObject ) ) ;
5646 expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Failed" ) ;
5747 } )
5848
5949 it ( 'ScanCreate Successful case no wait mode' , async ( ) => {
60- const params = new Map ( ) ;
6150 params . set ( CxParamType . PROJECT_NAME , "ast-cli-javascript-integration-nowait" ) ;
6251 params . set ( CxParamType . S , "./src" ) ;
6352 params . set ( CxParamType . SAST_PRESET_NAME , "Checkmarx Default Fake" ) ;
6453 params . set ( CxParamType . ADDITIONAL_PARAMETERS , "--async" ) ;
6554 params . set ( CxParamType . BRANCH , "master" ) ;
66-
6755 const auth = new CxWrapper ( cxScanConfig ) ;
68-
69- const data = await auth . scanCreate ( params ) ;
70- const cxCommandOutput : CxCommandOutput = data ;
71- const ScanObject = cxCommandOutput . payload . pop ( ) ;
72- const scanShowObject = await auth . scanShow ( ScanObject . ID ) ;
56+ const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
57+ const scanObject = cxCommandOutput . payload . pop ( ) ;
58+ const scanShowObject = await auth . scanShow ( scanObject . ID ) ;
7359 console . log ( " Json object from successful no wait mode case: " + JSON . stringify ( scanShowObject ) )
7460 expect ( scanShowObject . payload . pop ( ) . Status ) . toEqual ( "Running" )
7561 } )
7662
7763 it ( 'ScanList Successful case' , async ( ) => {
7864 const auth = new CxWrapper ( cxScanConfig ) ;
79- const data = await auth . scanList ( "" ) ;
80- const cxCommandOutput : CxCommandOutput = data ;
65+ const cxCommandOutput : CxCommandOutput = await auth . scanList ( "" ) ;
8166 expect ( cxCommandOutput . payload . length ) . toBeGreaterThan ( 0 ) ;
8267 } ) ;
8368} ) ;
0 commit comments