Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
Expand Down Expand Up @@ -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);
Comment thread
andrew-eldridge marked this conversation as resolved.

vscode.window.showInformationMessage(localize('finishedCreating', 'Finished creating project.'));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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');
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function createAzureWizard(wizardContext: IAzureConnectorsContext, projec
executeSteps: [new SaveAzureContext(projectPath)],
});
}

Comment thread
andrew-eldridge marked this conversation as resolved.
class GetSubscriptionDetailsStep extends AzureWizardPromptStep<IAzureConnectorsContext> {
private _projectPath: string;

Expand Down
Loading