@@ -33,21 +33,29 @@ const uploadSarifMacro = test.macro({
3333
3434 const toFullPath = ( filename : string ) => path . join ( tempDir , filename ) ;
3535
36- const uploadSpecifiedFiles = sinon . stub (
36+ const postProcessSarifFiles = sinon . stub (
3737 uploadLib ,
38- "uploadSpecifiedFiles" ,
38+ "postProcessSarifFiles" ,
39+ ) ;
40+ const uploadProcessedFiles = sinon . stub (
41+ uploadLib ,
42+ "uploadProcessedFiles" ,
3943 ) ;
4044
4145 for ( const analysisKind of Object . values ( AnalysisKind ) ) {
42- uploadSpecifiedFiles
46+ const analysisConfig = getAnalysisConfig ( analysisKind ) ;
47+ postProcessSarifFiles
4348 . withArgs (
49+ logger ,
4450 sinon . match . any ,
4551 sinon . match . any ,
4652 sinon . match . any ,
47- features ,
48- logger ,
49- getAnalysisConfig ( analysisKind ) ,
53+ sinon . match . any ,
54+ analysisConfig ,
5055 )
56+ . resolves ( { sarif : { runs : [ ] } , analysisKey : "" , environment : "" } ) ;
57+ uploadProcessedFiles
58+ . withArgs ( logger , sinon . match . any , analysisConfig , sinon . match . any )
5159 . resolves ( expectedResult [ analysisKind as AnalysisKind ] ?. uploadResult ) ;
5260 }
5361
@@ -63,35 +71,33 @@ const uploadSarifMacro = test.macro({
6371 if ( analysisKindResult ) {
6472 // We are expecting a result for this analysis kind, check that we have it.
6573 t . deepEqual ( actual [ analysisKind ] , analysisKindResult . uploadResult ) ;
66- // Additionally, check that the mocked `uploadSpecifiedFiles ` was called with only the file paths
74+ // Additionally, check that the mocked `postProcessSarifFiles ` was called with only the file paths
6775 // that we expected it to be called with.
6876 t . assert (
69- uploadSpecifiedFiles . calledWith (
77+ postProcessSarifFiles . calledWith (
78+ logger ,
79+ features ,
80+ sinon . match . any ,
7081 analysisKindResult . expectedFiles ?. map ( toFullPath ) ??
7182 fullSarifPaths ,
7283 sinon . match . any ,
73- sinon . match . any ,
74- features ,
75- logger ,
7684 getAnalysisConfig ( analysisKind ) ,
7785 ) ,
7886 ) ;
7987 } else {
8088 // Otherwise, we are not expecting a result for this analysis kind. However, note that `undefined`
81- // is also returned by our mocked `uploadSpecifiedFiles ` when there is no expected result for this
89+ // is also returned by our mocked `uploadProcessedFiles ` when there is no expected result for this
8290 // analysis kind.
8391 t . is ( actual [ analysisKind ] , undefined ) ;
84- // Therefore, we also check that the mocked `uploadSpecifiedFiles ` was not called for this analysis kind.
92+ // Therefore, we also check that the mocked `uploadProcessedFiles ` was not called for this analysis kind.
8593 t . assert (
86- ! uploadSpecifiedFiles . calledWith (
87- sinon . match . any ,
88- sinon . match . any ,
89- sinon . match . any ,
90- features ,
94+ ! uploadProcessedFiles . calledWith (
9195 logger ,
96+ sinon . match . any ,
9297 getAnalysisConfig ( analysisKind ) ,
98+ sinon . match . any ,
9399 ) ,
94- `uploadSpecifiedFiles was called for ${ analysisKind } , but should not have been.` ,
100+ `uploadProcessedFiles was called for ${ analysisKind } , but should not have been.` ,
95101 ) ;
96102 }
97103 }
0 commit comments