@@ -24,7 +24,7 @@ const auth = new CxAuth(cxScanConfig);
2424describe ( "ScanCreate cases" , ( ) => {
2525 it ( 'ScanCreate Successful case wait mode' , async ( ) => {
2626 const data = await auth . scanCreate ( params ) ;
27- const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
27+ const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
2828 const ScanObject = cxCommandOutput . scanObjectList . pop ( )
2929 const scanShowObject = await auth . scanShow ( ScanObject . ID ) ;
3030 console . log ( " Json object from successful wait mode case: " + JSON . stringify ( scanShowObject ) )
@@ -35,7 +35,7 @@ describe("ScanCreate cases",() => {
3535 params . set ( CxParamType . BRANCH , "master" ) ;
3636 //params.set(CxParamType.PROJECT_NAME, "ASTJavascriptWrapperTest");
3737 const data = await auth . scanCreate ( params ) ;
38- const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
38+ const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
3939 const ScanObject = cxCommandOutput . scanObjectList . pop ( )
4040 const scanShowObject = await auth . scanShow ( ScanObject . ID ) ;
4141 console . log ( " Json object from successful wait mode case with branch: " + JSON . stringify ( scanShowObject ) )
@@ -46,7 +46,7 @@ describe("ScanCreate cases",() => {
4646 it ( 'ScanCreate Failure case' , async ( ) => {
4747 params . set ( CxParamType . SAST_PRESET_NAME , "Checkmarx Default Fake" ) ;
4848 const data = await auth . scanCreate ( params ) ;
49- const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
49+ const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
5050 const ScanObject = cxCommandOutput . scanObjectList . pop ( )
5151 const scanShowObject = await auth . scanShow ( ScanObject . ID ) ;
5252 console . log ( " Json object from failure case: " + JSON . stringify ( scanShowObject ) )
@@ -58,7 +58,7 @@ describe("ScanCreate cases",() => {
5858 params . set ( CxParamType . SAST_PRESET_NAME , "Checkmarx Default" ) ;
5959 params . set ( CxParamType . ADDITIONAL_PARAMETERS , "--nowait" ) ;
6060 const data = await auth . scanCreate ( params ) ;
61- const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
61+ const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
6262 const ScanObject = cxCommandOutput . scanObjectList . pop ( )
6363 const scanShowObject = await auth . scanShow ( ScanObject . ID ) ;
6464 console . log ( " Json object from successful no wait mode case: " + JSON . stringify ( scanShowObject ) )
@@ -70,53 +70,54 @@ describe("ScanCreate cases",() => {
7070describe ( "ScanList cases" , ( ) => {
7171 it ( 'ScanList Successful case' , async ( ) => {
7272 const data = await auth . scanList ( ) ;
73- const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
73+ const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
7474 expect ( cxCommandOutput . scanObjectList . length ) . toBeGreaterThan ( 0 ) ;
7575 } ) ;
7676} ) ;
7777
7878describe ( "ProjectList cases" , ( ) => {
7979 it ( 'ProjectList Successful case' , async ( ) => {
8080 const data = await auth . projectList ( ) ;
81- const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
81+ const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
8282 expect ( cxCommandOutput . scanObjectList . length ) . toBeGreaterThan ( 0 ) ;
8383 } ) ;
8484} ) ;
8585
8686describe ( "Results cases" , ( ) => {
8787 it ( 'Result Test Successful case' , async ( ) => {
8888 const data = await auth . scanList ( ) ;
89- const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
89+ const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
9090 let sampleId = cxCommandOutput . scanObjectList . pop ( ) . ID ;
91- const written = await auth . getResults ( sampleId , "test. json" , null )
91+ const written = await auth . getResults ( sampleId , "json" , "jsonList" , "." )
9292 console . log ( written )
93- expect ( cxCommandOutput . scanObjectList . length ) . toBeGreaterThan ( 0 ) ;
93+ const file = await fileExists ( "./jsonList.json" ) ;
94+ expect ( file ) . toBe ( true ) ;
9495 } ) ;
9596
9697 it ( 'Result List Successful case' , async ( ) => {
9798 const data = await auth . scanList ( ) ;
98- const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
99+ const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
99100 let sampleId = cxCommandOutput . scanObjectList . pop ( ) . ID ;
100- const written = await auth . getResultsList ( sampleId , "json" )
101+ const written = await auth . getResultsList ( sampleId )
101102 console . log ( written )
102103 expect ( written . length ) . toBeGreaterThan ( 0 ) ;
103104 } ) ;
104105
105106 it ( 'Result summary html file generation successful case' , async ( ) => {
106107 const data = await auth . scanList ( ) ;
107- const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
108+ const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
108109 let sampleId = cxCommandOutput . scanObjectList . pop ( ) . ID ;
109- const written = await auth . getResultsSummary ( sampleId , "html " , "./ test.html " )
110+ const written = await auth . getResults ( sampleId , "summaryHTML " , "test" , ". ")
110111 console . log ( written )
111112 const file = await fileExists ( "./test.html" ) ;
112113 expect ( file ) . toBe ( true ) ;
113114 } ) ;
114115
115116 it ( 'Result summary html string successful case' , async ( ) => {
116117 const data = await auth . scanList ( ) ;
117- const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
118+ const cxCommandOutput : CxCommandOutput = JSON . parse ( JSON . stringify ( data ) )
118119 let sampleId = cxCommandOutput . scanObjectList . pop ( ) . ID ;
119- const written = await auth . getResultsSummary ( sampleId , "html" , null )
120+ const written = await auth . getResultsSummary ( sampleId )
120121 console . log ( written )
121122 expect ( written . length ) . toBeGreaterThan ( 0 ) ;
122123 } ) ;
0 commit comments