@@ -3,10 +3,12 @@ import { CxParamType } from "../main/wrapper/CxParamType";
3
3
import { BaseTest } from "./BaseTest" ;
4
4
import CxWrapperFactory from "../main/wrapper/CxWrapperFactory" ;
5
5
6
+ const cxWrapperFactory = new CxWrapperFactory ( ) ;
7
+
6
8
describe ( "ScanCreate cases" , ( ) => {
7
9
const cxScanConfig = new BaseTest ( ) ;
8
10
it ( 'ScanList Successful case' , async ( ) => {
9
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
11
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
10
12
const cxCommandOutput : CxCommandOutput = await auth . scanList ( "" ) ;
11
13
console . log ( " Json object from scanList successful case: " + JSON . stringify ( cxCommandOutput ) ) ;
12
14
expect ( cxCommandOutput . payload . length ) . toBeGreaterThan ( 1 ) ;
@@ -20,7 +22,7 @@ describe("ScanCreate cases", () => {
20
22
params . set ( CxParamType . FILTER , "*.ts,!**/node_modules/**/*" ) ;
21
23
params . set ( CxParamType . BRANCH , "master" ) ;
22
24
params . set ( CxParamType . SCAN_TYPES , "kics" ) ;
23
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
25
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
24
26
const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
25
27
const scanObject = cxCommandOutput . payload . pop ( ) ;
26
28
const scanShowObject = await auth . scanShow ( scanObject . id ) ;
@@ -35,7 +37,7 @@ describe("ScanCreate cases", () => {
35
37
params . set ( CxParamType . SAST_PRESET_NAME , "Checkmarx Default Fake" ) ;
36
38
params . set ( CxParamType . BRANCH , "master" ) ;
37
39
params . set ( CxParamType . SCAN_TYPES , "sast" ) ;
38
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
40
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
39
41
const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
40
42
const scanObject = cxCommandOutput . payload . pop ( ) ;
41
43
const scanShowObject = await auth . scanShow ( scanObject . id ) ;
@@ -50,7 +52,7 @@ describe("ScanCreate cases", () => {
50
52
params . set ( CxParamType . FILTER , "*.ts,!**/node_modules/**/*" ) ;
51
53
params . set ( CxParamType . BRANCH , "master" ) ;
52
54
params . set ( CxParamType . ADDITIONAL_PARAMETERS , "--scan-types sast" ) ;
53
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
55
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
54
56
const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
55
57
const scanObject = cxCommandOutput . payload . pop ( ) ;
56
58
const scanShowObject = await auth . scanShow ( scanObject . id ) ;
@@ -66,7 +68,7 @@ describe("ScanCreate cases", () => {
66
68
params . set ( CxParamType . SAST_PRESET_NAME , "Checkmarx Default Fake" ) ;
67
69
params . set ( CxParamType . ADDITIONAL_PARAMETERS , "--async" ) ;
68
70
params . set ( CxParamType . BRANCH , "master" ) ;
69
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
71
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
70
72
const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
71
73
const scanObject = cxCommandOutput . payload . pop ( ) ;
72
74
const scanShowObject = await auth . scanShow ( scanObject . id ) ;
@@ -81,7 +83,7 @@ describe("ScanCreate cases", () => {
81
83
params . set ( CxParamType . BRANCH , "master" ) ;
82
84
params . set ( CxParamType . FILTER , "*.ts,!**/node_modules/**/*" ) ;
83
85
params . set ( CxParamType . ADDITIONAL_PARAMETERS , "--async" ) ;
84
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
86
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
85
87
const cxCommandOutput : CxCommandOutput = await auth . scanCreate ( params ) ;
86
88
const scanObject = cxCommandOutput . payload . pop ( ) ;
87
89
await auth . scanCancel ( scanObject . id )
@@ -90,7 +92,7 @@ describe("ScanCreate cases", () => {
90
92
} )
91
93
92
94
it ( 'KicsRealtime Successful case ' , async ( ) => {
93
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
95
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
94
96
const [ outputProcess , pid ] = await auth . kicsRealtimeScan ( "dist/tests/data/Dockerfile" , "docker" , "-v" ) ;
95
97
const cxCommandOutput : CxCommandOutput = await outputProcess ;
96
98
console . log ( " Json object from successful no wait mode case: " + JSON . stringify ( cxCommandOutput . payload ) ) ;
@@ -101,7 +103,7 @@ describe("ScanCreate cases", () => {
101
103
} )
102
104
103
105
it ( 'ScaRealtime Successful case' , async ( ) => {
104
- const wrapper = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
106
+ const wrapper = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
105
107
const cxCommandOutput : CxCommandOutput = await wrapper . runScaRealtimeScan ( process . cwd ( ) ) ;
106
108
if ( cxCommandOutput . exitCode == 1 ) {
107
109
expect ( cxCommandOutput . payload ) . toBeUndefined ( ) ;
@@ -113,20 +115,20 @@ describe("ScanCreate cases", () => {
113
115
114
116
it ( "Should check if scan create is possible" , async ( ) => {
115
117
const cxScanConfig = new BaseTest ( ) ;
116
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
118
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
117
119
const tenantSettings : boolean = await auth . ideScansEnabled ( ) ;
118
120
expect ( tenantSettings ) . toBeDefined ( ) ;
119
121
} )
120
122
121
123
it ( "Should check if AI guided remediation is active" , async ( ) => {
122
124
const cxScanConfig = new BaseTest ( ) ;
123
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
125
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
124
126
const aiEnabled : boolean = await auth . guidedRemediationEnabled ( ) ;
125
127
expect ( aiEnabled ) . toBeDefined ( ) ;
126
128
} )
127
129
128
130
it ( 'ScanVorpal fail case Without extensions' , async ( ) => {
129
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
131
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
130
132
const cxCommandOutput : CxCommandOutput = await auth . scanVorpal ( "tsc/tests/data/python-file" ) ;
131
133
console . log ( " Json object from failure case: " + JSON . stringify ( cxCommandOutput ) ) ;
132
134
@@ -136,7 +138,7 @@ describe("ScanCreate cases", () => {
136
138
} ) ;
137
139
138
140
it ( 'ScanVorpal Successful case' , async ( ) => {
139
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
141
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
140
142
const cxCommandOutput : CxCommandOutput = await auth . scanVorpal ( "tsc/tests/data/python-vul-file.py" ) ;
141
143
console . log ( "Json object from scanVorpal successful case: " + JSON . stringify ( cxCommandOutput ) ) ;
142
144
const scanObject = cxCommandOutput . payload . pop ( ) ;
@@ -146,7 +148,7 @@ describe("ScanCreate cases", () => {
146
148
} ) ;
147
149
148
150
it ( 'ScanVorpal with complex name Successful case' , async ( ) => {
149
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
151
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
150
152
const cxCommandOutput : CxCommandOutput = await auth . scanVorpal ( "tsc/tests/data/var express = require('express';.js" ) ;
151
153
console . log ( "Json object from scanVorpal successful case: " + JSON . stringify ( cxCommandOutput ) ) ;
152
154
const scanObject = cxCommandOutput . payload . pop ( ) ;
@@ -156,7 +158,7 @@ describe("ScanCreate cases", () => {
156
158
} ) ;
157
159
158
160
it ( 'ScanVorpal Successful case with update version' , async ( ) => {
159
- const auth = await CxWrapperFactory . createWrapper ( cxScanConfig ) ;
161
+ const auth = await cxWrapperFactory . createWrapper ( cxScanConfig ) ;
160
162
const cxCommandOutput : CxCommandOutput = await auth . scanVorpal ( "tsc/tests/data/python-vul-file.py" , true ) ;
161
163
console . log ( "Json object from scanVorpal successful case with update version: " + JSON . stringify ( cxCommandOutput ) ) ;
162
164
const scanObject = cxCommandOutput . payload . pop ( ) ;
0 commit comments