@@ -125,4 +125,36 @@ describe("ScanCreate cases", () => {
125125 expect ( aiEnabled ) . toBeDefined ( ) ;
126126 } )
127127
128- } ) ;
128+ it ( 'ScanVorpal fail case Without extensions' , async ( ) => {
129+ const auth = new CxWrapper ( cxScanConfig ) ;
130+ const cxCommandOutput : CxCommandOutput = await auth . scanVorpal ( "tsc/tests/data/python-file" ) ;
131+ console . log ( " Json object from failure case: " + JSON . stringify ( cxCommandOutput ) ) ;
132+
133+ expect ( cxCommandOutput . payload [ 0 ] . error . description ) . toEqual ( "The file name must have an extension." ) ;
134+ expect ( cxCommandOutput . exitCode ) . toBe ( 0 ) ;
135+ expect ( cxCommandOutput . payload [ 0 ] . status ) . toBeUndefined ( ) ;
136+ } ) ;
137+
138+ it ( 'ScanVorpal Successful case' , async ( ) => {
139+ const auth = new CxWrapper ( cxScanConfig ) ;
140+ const cxCommandOutput : CxCommandOutput = await auth . scanVorpal ( "tsc/tests/data/python-vul-file.py" ) ;
141+ console . log ( "Json object from scanVorpal successful case: " + JSON . stringify ( cxCommandOutput ) ) ;
142+ const scanObject = cxCommandOutput . payload . pop ( ) ;
143+ expect ( cxCommandOutput . payload ) . toBeDefined ( ) ;
144+ expect ( cxCommandOutput . exitCode ) . toBe ( 0 ) ;
145+ expect ( scanObject . status ) . toEqual ( true ) ;
146+ } ) ;
147+
148+ it ( 'ScanVorpal Successful case with update version' , async ( ) => {
149+ const auth = new CxWrapper ( cxScanConfig ) ;
150+ const cxCommandOutput : CxCommandOutput = await auth . scanVorpal ( "tsc/tests/data/python-vul-file.py" , true ) ;
151+ console . log ( "Json object from scanVorpal successful case with update version: " + JSON . stringify ( cxCommandOutput ) ) ;
152+ const scanObject = cxCommandOutput . payload . pop ( ) ;
153+ expect ( cxCommandOutput . payload ) . toBeDefined ( ) ;
154+ expect ( cxCommandOutput . exitCode ) . toBe ( 0 ) ;
155+ expect ( scanObject . status ) . toEqual ( true ) ;
156+ expect ( Number . isInteger ( scanObject . scanDetails [ 0 ] . line ) ) . toBe ( true ) ;
157+ expect ( typeof scanObject . scanDetails [ 0 ] . description ) . toBe ( 'string' ) ;
158+ } ) ;
159+
160+ } ) ;
0 commit comments