mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-15 01:25:36 -05:00
Open sql projects in opened folder (#11333)
* open projects in workspace automatically * add test * fix for windows
This commit is contained in:
@@ -14,7 +14,7 @@ import * as constants from '../common/constants';
|
||||
|
||||
import { createContext, TestContext } from './testContext';
|
||||
import MainController from '../controllers/mainController';
|
||||
import { shouldThrowSpecificError } from './testUtils';
|
||||
import { shouldThrowSpecificError, generateTestFolderPath, createTestProject } from './testUtils';
|
||||
|
||||
let testContext: TestContext;
|
||||
|
||||
@@ -77,4 +77,27 @@ describe('MainController: main controller operations', function (): void {
|
||||
should.doesNotThrow(() => controller.activate(), 'activate() should not throw an error');
|
||||
should.doesNotThrow(() => controller.dispose(), 'dispose() should not throw an error');
|
||||
});
|
||||
|
||||
it('Should load projects in workspace', async function (): Promise<void> {
|
||||
const rootFolderPath = await generateTestFolderPath();
|
||||
const project = await createTestProject(baselines.openProjectFileBaseline, rootFolderPath);
|
||||
const nestedFolder = path.join(rootFolderPath, 'nestedProject');
|
||||
const nestedProject = await createTestProject(baselines.openProjectFileBaseline, nestedFolder);
|
||||
|
||||
testContext.apiWrapper.setup(x => x.workspaceFolders()).returns(() => [workspaceFolder]);
|
||||
const workspaceFolder: vscode.WorkspaceFolder = {
|
||||
uri: vscode.Uri.file(rootFolderPath),
|
||||
name: '',
|
||||
index: 0
|
||||
};
|
||||
|
||||
const controller = new MainController(testContext.context, testContext.apiWrapper.object);
|
||||
should(controller.projController.projects.length).equal(0);
|
||||
|
||||
await controller.loadProjectsInWorkspace();
|
||||
|
||||
should(controller.projController.projects.length).equal(2);
|
||||
should(controller.projController.projects[0].projectFolderPath).equal(project.projectFolderPath);
|
||||
should(controller.projController.projects[1].projectFolderPath).equal(nestedProject.projectFolderPath);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user