@@ -90,6 +90,7 @@ describe('Variant Analysis Manager', async function() {
9090 let mockGetRepositoryFromNwo : sinon . SinonStub ;
9191 let mockSubmitVariantAnalysis : sinon . SinonStub ;
9292 let mockApiResponse : VariantAnalysisApiResponse ;
93+ let executeCommandSpy : sinon . SinonStub ;
9394
9495 const baseDir = path . join ( __dirname , '../../../../src/vscode-tests/cli-integration' ) ;
9596 function getFile ( file : string ) : Uri {
@@ -111,6 +112,8 @@ describe('Variant Analysis Manager', async function() {
111112 . onFirstCall ( ) . resolves ( { repositories : [ 'github/vscode-codeql' ] } as unknown as QuickPickItem )
112113 . onSecondCall ( ) . resolves ( 'javascript' as unknown as QuickPickItem ) ;
113114
115+ executeCommandSpy = sandbox . stub ( commands , 'executeCommand' ) . callThrough ( ) ;
116+
114117 cancellationTokenSource = new CancellationTokenSource ( ) ;
115118
116119 const dummyRepository : Repository = {
@@ -132,10 +135,9 @@ describe('Variant Analysis Manager', async function() {
132135 it ( 'should run a variant analysis that is part of a qlpack' , async ( ) => {
133136 const fileUri = getFile ( 'data-remote-qlpack/in-pack.ql' ) ;
134137
135- const variantAnalysis = await variantAnalysisManager . runVariantAnalysis ( fileUri , progress , cancellationTokenSource . token ) ;
136- expect ( variantAnalysis ) . to . be . ok ;
137- expect ( variantAnalysis . id ) . to . be . equal ( mockApiResponse . id ) ;
138- expect ( variantAnalysis . status ) . to . be . equal ( VariantAnalysisStatus . InProgress ) ;
138+ await variantAnalysisManager . runVariantAnalysis ( fileUri , progress , cancellationTokenSource . token ) ;
139+
140+ expect ( executeCommandSpy ) . to . have . been . calledWith ( 'codeQL.monitorVariantAnalysis' , sinon . match . has ( 'id' , mockApiResponse . id ) . and ( sinon . match . has ( 'status' , VariantAnalysisStatus . InProgress ) ) ) ;
139141
140142 expect ( showQuickPickSpy ) . to . have . been . calledOnce ;
141143
@@ -146,10 +148,9 @@ describe('Variant Analysis Manager', async function() {
146148 it ( 'should run a remote query that is not part of a qlpack' , async ( ) => {
147149 const fileUri = getFile ( 'data-remote-no-qlpack/in-pack.ql' ) ;
148150
149- const variantAnalysis = await variantAnalysisManager . runVariantAnalysis ( fileUri , progress , cancellationTokenSource . token ) ;
150- expect ( variantAnalysis ) . to . be . ok ;
151- expect ( variantAnalysis . id ) . to . be . equal ( mockApiResponse . id ) ;
152- expect ( variantAnalysis . status ) . to . be . equal ( VariantAnalysisStatus . InProgress ) ;
151+ await variantAnalysisManager . runVariantAnalysis ( fileUri , progress , cancellationTokenSource . token ) ;
152+
153+ expect ( executeCommandSpy ) . to . have . been . calledWith ( 'codeQL.monitorVariantAnalysis' , sinon . match . has ( 'id' , mockApiResponse . id ) . and ( sinon . match . has ( 'status' , VariantAnalysisStatus . InProgress ) ) ) ;
153154
154155 expect ( mockGetRepositoryFromNwo ) . to . have . been . calledOnce ;
155156 expect ( mockSubmitVariantAnalysis ) . to . have . been . calledOnce ;
@@ -158,10 +159,9 @@ describe('Variant Analysis Manager', async function() {
158159 it ( 'should run a remote query that is nested inside a qlpack' , async ( ) => {
159160 const fileUri = getFile ( 'data-remote-qlpack-nested/subfolder/in-pack.ql' ) ;
160161
161- const variantAnalysis = await variantAnalysisManager . runVariantAnalysis ( fileUri , progress , cancellationTokenSource . token ) ;
162- expect ( variantAnalysis ) . to . be . ok ;
163- expect ( variantAnalysis . id ) . to . be . equal ( mockApiResponse . id ) ;
164- expect ( variantAnalysis . status ) . to . be . equal ( VariantAnalysisStatus . InProgress ) ;
162+ await variantAnalysisManager . runVariantAnalysis ( fileUri , progress , cancellationTokenSource . token ) ;
163+
164+ expect ( executeCommandSpy ) . to . have . been . calledWith ( 'codeQL.monitorVariantAnalysis' , sinon . match . has ( 'id' , mockApiResponse . id ) . and ( sinon . match . has ( 'status' , VariantAnalysisStatus . InProgress ) ) ) ;
165165
166166 expect ( mockGetRepositoryFromNwo ) . to . have . been . calledOnce ;
167167 expect ( mockSubmitVariantAnalysis ) . to . have . been . calledOnce ;
0 commit comments