@@ -61,6 +61,7 @@ describe("Variant Analysis Manager", () => {
6161 let pathExistsStub : jest . SpiedFunction < typeof fs . pathExists > ;
6262 let readJsonStub : jest . SpiedFunction < typeof fs . readJson > ;
6363 let outputJsonStub : jest . SpiedFunction < typeof fs . outputJson > ;
64+ let writeFileStub : jest . SpiedFunction < typeof fs . writeFile > ;
6465 let cli : CodeQLCliServer ;
6566 let cancellationTokenSource : CancellationTokenSource ;
6667 let variantAnalysisManager : VariantAnalysisManager ;
@@ -72,13 +73,13 @@ describe("Variant Analysis Manager", () => {
7273 pathExistsStub = jest . spyOn ( fs , "pathExists" ) ;
7374 readJsonStub = jest . spyOn ( fs , "readJson" ) ;
7475 outputJsonStub = jest . spyOn ( fs , "outputJson" ) . mockReturnValue ( undefined ) ;
76+ writeFileStub = jest . spyOn ( fs , "writeFile" ) . mockReturnValue ( undefined ) ;
7577
7678 jest . spyOn ( logger , "log" ) . mockResolvedValue ( undefined ) ;
7779 jest
7880 . spyOn ( config , "isVariantAnalysisLiveResultsEnabled" )
7981 . mockReturnValue ( false ) ;
8082 jest . spyOn ( fs , "mkdirSync" ) . mockReturnValue ( undefined ) ;
81- jest . spyOn ( fs , "writeFile" ) . mockReturnValue ( undefined ) ;
8283
8384 cancellationTokenSource = new CancellationTokenSource ( ) ;
8485
@@ -132,6 +133,8 @@ describe("Variant Analysis Manager", () => {
132133 }
133134
134135 beforeEach ( async ( ) => {
136+ writeFileStub . mockRestore ( ) ;
137+
135138 // Should not have asked for a language
136139 showQuickPickSpy = jest
137140 . spyOn ( window , "showQuickPick" )
@@ -293,7 +296,6 @@ describe("Variant Analysis Manager", () => {
293296 await variantAnalysisManager . getVariantAnalysis ( variantAnalysis . id ) ,
294297 ) . toEqual ( variantAnalysis ) ;
295298
296- expect ( pathExistsStub ) . toHaveBeenCalledTimes ( 1 ) ;
297299 expect ( pathExistsStub ) . toBeCalledWith (
298300 path . join ( storagePath , variantAnalysis . id . toString ( ) ) ,
299301 ) ;
@@ -630,7 +632,7 @@ describe("Variant Analysis Manager", () => {
630632 // The actual tests for these are in rehydrateVariantAnalysis, so we can just mock them here and test that
631633 // the methods are called.
632634
633- pathExistsStub . mockImplementation ( ( ) => false ) ;
635+ pathExistsStub . mockImplementation ( ( ) => true ) ;
634636 // This will read in the correct repo states
635637 readJsonStub . mockImplementation ( ( ) =>
636638 Promise . resolve ( {
@@ -651,7 +653,6 @@ describe("Variant Analysis Manager", () => {
651653 variantAnalysis ,
652654 ) ;
653655
654- expect ( pathExistsStub ) . toHaveBeenCalledTimes ( 1 ) ;
655656 expect ( pathExistsStub ) . toBeCalledWith (
656657 path . join ( storagePath , variantAnalysis . id . toString ( ) ) ,
657658 ) ;
@@ -664,6 +665,8 @@ describe("Variant Analysis Manager", () => {
664665 ) ,
665666 ) ;
666667
668+ pathExistsStub . mockRestore ( ) ;
669+
667670 await variantAnalysisManager . autoDownloadVariantAnalysisResult (
668671 scannedRepos [ 0 ] ,
669672 variantAnalysis ,
0 commit comments