@@ -29,6 +29,8 @@ import * as WorkspaceInfoFinderUtil from "../../../../../common/utilities/Worksp
2929import path from 'path' ;
3030import { SiteVisibility } from '../../../../power-pages/actions-hub/models/SiteVisibility' ;
3131import * as TelemetryHelper from '../../../../power-pages/actions-hub/TelemetryHelper' ;
32+ import { CODEQL_EXTENSION_ID } from '../../../../../common/constants' ;
33+ import { CodeQLAction } from '../../../../power-pages/actions-hub/actions/codeQLAction' ;
3234
3335describe ( 'ActionsHubCommandHandlers' , ( ) => {
3436 let sandbox : sinon . SinonSandbox ;
@@ -1502,21 +1504,27 @@ describe('ActionsHubCommandHandlers', () => {
15021504 let mockShowWarningMessage : sinon . SinonStub ;
15031505 let mockGetExtension : sinon . SinonStub ;
15041506 let mockShowProgressNotification : sinon . SinonStub ;
1507+ let mockExecuteCommand : sinon . SinonStub ;
1508+ let mockCodeQLAction : sinon . SinonStubbedInstance < CodeQLAction > ;
15051509 let mockSiteTreeItem : SiteTreeItem ;
1506- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1507- let mockHasPowerPagesSiteFolder : sinon . SinonStub ;
15081510
15091511 beforeEach ( ( ) => {
15101512 mockShowErrorMessage = sandbox . stub ( vscode . window , 'showErrorMessage' ) ;
15111513 mockShowWarningMessage = sandbox . stub ( vscode . window , 'showWarningMessage' ) ;
15121514 mockGetExtension = sandbox . stub ( vscode . extensions , 'getExtension' ) ;
1515+ mockExecuteCommand = sandbox . stub ( vscode . commands , 'executeCommand' ) ;
15131516 mockShowProgressNotification = sandbox . stub ( Utils , 'showProgressWithNotification' ) . callsFake ( async ( title : string , task : ( progress : vscode . Progress < {
15141517 message ?: string ;
15151518 increment ?: number ;
15161519 // eslint-disable-next-line @typescript-eslint/no-explicit-any
15171520 } > ) => Promise < any > ) => await task ( { } as unknown as vscode . Progress < { message ?: string ; increment ?: number } > ) ) ;
15181521
1519- mockHasPowerPagesSiteFolder = sandbox . stub ( WorkspaceInfoFinderUtil , 'hasPowerPagesSiteFolder' ) . returns ( true ) ;
1522+ // Mock CodeQLAction constructor and methods
1523+ mockCodeQLAction = {
1524+ executeCodeQLAnalysisWithCustomPath : sandbox . stub ( ) . resolves ( ) ,
1525+ dispose : sandbox . stub ( )
1526+ } as sinon . SinonStubbedInstance < CodeQLAction > ;
1527+ sandbox . stub ( CodeQLAction . prototype , 'executeCodeQLAnalysisWithCustomPath' ) . callsFake ( mockCodeQLAction . executeCodeQLAnalysisWithCustomPath ) ;
15201528
15211529 mockSiteTreeItem = new SiteTreeItem ( {
15221530 name : "Test Site" ,
@@ -1540,12 +1548,13 @@ describe('ActionsHubCommandHandlers', () => {
15401548
15411549 await runCodeQLScreening ( mockSiteTreeItem ) ;
15421550
1543- expect ( mockGetExtension . calledWith ( 'github.vscode-codeql' ) ) . to . be . true ;
1551+ expect ( mockGetExtension . calledWith ( CODEQL_EXTENSION_ID ) ) . to . be . true ;
15441552 expect ( mockShowWarningMessage . calledWith (
15451553 Constants . Strings . CODEQL_EXTENSION_NOT_INSTALLED ,
15461554 Constants . Strings . INSTALL ,
15471555 Constants . Strings . CANCEL
15481556 ) ) . to . be . true ;
1557+ expect ( mockExecuteCommand . calledWith ( 'workbench.extensions.installExtension' , CODEQL_EXTENSION_ID ) ) . to . be . true ;
15491558 } ) ;
15501559
15511560 it ( 'should show error when current site path not found' , async ( ) => {
@@ -1564,6 +1573,7 @@ describe('ActionsHubCommandHandlers', () => {
15641573 await runCodeQLScreening ( mockSiteTreeItem ) ;
15651574
15661575 expect ( mockShowProgressNotification . calledWith ( Constants . Strings . CODEQL_SCREENING_STARTED ) ) . to . be . true ;
1576+ expect ( mockCodeQLAction . executeCodeQLAnalysisWithCustomPath . called ) . to . be . true ;
15671577 } ) ;
15681578
15691579 it ( 'should handle errors gracefully' , async ( ) => {
0 commit comments