diff --git a/apps/vs-code-designer/src/app/commands/createNewCodeProject/CodeProjectBase/CreateLogicAppProjects.ts b/apps/vs-code-designer/src/app/commands/createNewCodeProject/CodeProjectBase/CreateLogicAppProjects.ts index 9b1d030f41a..3387f979101 100644 --- a/apps/vs-code-designer/src/app/commands/createNewCodeProject/CodeProjectBase/CreateLogicAppProjects.ts +++ b/apps/vs-code-designer/src/app/commands/createNewCodeProject/CodeProjectBase/CreateLogicAppProjects.ts @@ -18,6 +18,8 @@ import { createRulesFiles, updateWorkspaceFile, } from './CreateLogicAppWorkspace'; +import { getAzureConnectorDetailsForLocalProject } from '../../../utils/codeless/common'; +import { startDesignTimeApi } from '../../../utils/codeless/startDesignTimeApi'; import { devContainerFolderName, devContainerFileName } from '../../../../constants'; export async function createLogicAppProject(context: IActionContext, options: any, workspaceRootFolder: any): Promise { @@ -90,6 +92,10 @@ export async function createLogicAppProject(context: IActionContext, options: an const createFunctionAppFilesStep = new CreateFunctionAppFiles(); await createFunctionAppFilesStep.setup(mySubContext); } + + getAzureConnectorDetailsForLocalProject(context, logicAppFolderPath); + startDesignTimeApi(logicAppFolderPath); + vscode.window.showInformationMessage(localize('finishedCreating', 'Finished creating project.')); } diff --git a/apps/vs-code-designer/src/app/commands/createNewCodeProject/CodeProjectBase/__test__/CreateLogicAppProject.test.ts b/apps/vs-code-designer/src/app/commands/createNewCodeProject/CodeProjectBase/__test__/CreateLogicAppProject.test.ts index fc43139449e..a9bdfecfcab 100644 --- a/apps/vs-code-designer/src/app/commands/createNewCodeProject/CodeProjectBase/__test__/CreateLogicAppProject.test.ts +++ b/apps/vs-code-designer/src/app/commands/createNewCodeProject/CodeProjectBase/__test__/CreateLogicAppProject.test.ts @@ -14,6 +14,8 @@ import { updateWorkspaceFile, } from '../CreateLogicAppWorkspace'; import { createLogicAppVsCodeContents } from '../CreateLogicAppVSCodeContents'; +import { getAzureConnectorDetailsForLocalProject } from '../../../../utils/codeless/common'; +import { startDesignTimeApi } from '../../../../utils/codeless/startDesignTimeApi'; import { ProjectType } from '@microsoft/vscode-extension-logic-apps'; import type { IActionContext } from '@microsoft/vscode-azext-utils'; import type { IWebviewProjectContext, IProjectWizardContext } from '@microsoft/vscode-extension-logic-apps'; @@ -28,6 +30,8 @@ import * as fse from 'fs-extra'; vi.mock('../../../../utils/funcCoreTools/funcVersion'); vi.mock('../../../../utils/git'); vi.mock('../../../../utils/codeless/artifacts'); +vi.mock('../../../../utils/codeless/common'); +vi.mock('../../../../utils/codeless/startDesignTimeApi'); // Keep these mocked for unit tests, but will unmock for integration tests vi.mock('../CreateFunctionAppFiles'); @@ -105,6 +109,8 @@ describe('createLogicAppProject', () => { (createRulesFiles as Mock).mockResolvedValue(undefined); (createLibFolder as Mock).mockResolvedValue(undefined); (gitInit as Mock).mockResolvedValue(undefined); + (getAzureConnectorDetailsForLocalProject as Mock).mockResolvedValue(undefined); + (startDesignTimeApi as Mock).mockResolvedValue(undefined); }); afterEach(async () => { @@ -263,6 +269,27 @@ describe('createLogicAppProject', () => { expect(vscode.window.showInformationMessage).toHaveBeenCalledWith(expect.stringContaining('Finished creating project')); }); + it('should call getAzureConnectorDetailsForLocalProject on successful creation', async () => { + await createLogicAppProject(mockContext, mockOptions, workspaceRootFolder); + + expect(getAzureConnectorDetailsForLocalProject).toHaveBeenCalledWith(mockContext, logicAppFolderPath); + }); + + it('should call startDesignTimeApi on successful creation', async () => { + await createLogicAppProject(mockContext, mockOptions, workspaceRootFolder); + + expect(startDesignTimeApi).toHaveBeenCalledWith(logicAppFolderPath); + }); + + it('should not call design-time functions when not in a workspace', async () => { + (vscode.workspace as any).workspaceFile = undefined; + + await createLogicAppProject(mockContext, mockOptions, workspaceRootFolder); + + expect(getAzureConnectorDetailsForLocalProject).not.toHaveBeenCalled(); + expect(startDesignTimeApi).not.toHaveBeenCalled(); + }); + it('should set shouldCreateLogicAppProject to false when logic app exists', async () => { // Create a valid logic app structure with proper workflow.json schema await fse.ensureDir(logicAppFolderPath); diff --git a/apps/vs-code-designer/src/app/commands/workflows/azureConnectorWizard.ts b/apps/vs-code-designer/src/app/commands/workflows/azureConnectorWizard.ts index 530bfffe1d0..8ea4097e7ac 100644 --- a/apps/vs-code-designer/src/app/commands/workflows/azureConnectorWizard.ts +++ b/apps/vs-code-designer/src/app/commands/workflows/azureConnectorWizard.ts @@ -41,6 +41,7 @@ export function createAzureWizard(wizardContext: IAzureConnectorsContext, projec executeSteps: [new SaveAzureContext(projectPath)], }); } + class GetSubscriptionDetailsStep extends AzureWizardPromptStep { private _projectPath: string;