Add an informational message when a user tries to open an already opened project (#13853)

This commit is contained in:
Sakshi Sharma
2020-12-18 12:33:33 -08:00
committed by GitHub
parent 72a3aa1207
commit 0b8b6064ed
3 changed files with 7 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import * as TypeMoq from 'typemoq';
import { WorkspaceService } from '../services/workspaceService';
import { ProjectProviderRegistry } from '../common/projectProviderRegistry';
import { createProjectProvider } from './projectProviderRegistry.test';
import { ProjectAlreadyOpened } from '../common/constants';
const DefaultWorkspaceFilePath = '/test/folder/ws.code-workspace';
@@ -204,6 +205,7 @@ suite('WorkspaceService Tests', function (): void {
const updateConfigurationStub = sinon.stub();
const getConfigurationStub = sinon.stub().returns([processPath('folder1/proj2.sqlproj')]);
const onWorkspaceProjectsChangedStub = sinon.stub();
const showInformationMessageStub = sinon.stub(vscode.window, 'showInformationMessage');
const onWorkspaceProjectsChangedDisposable = service.onDidWorkspaceProjectsChange(() => {
onWorkspaceProjectsChangedStub();
});
@@ -220,6 +222,8 @@ suite('WorkspaceService Tests', function (): void {
]);
should.strictEqual(updateConfigurationStub.calledOnce, true, 'update configuration should have been called once');
should.strictEqual(updateWorkspaceFoldersStub.calledOnce, true, 'updateWorkspaceFolders should have been called once');
should.strictEqual(showInformationMessageStub.calledOnce, true, 'showInformationMessage should be called once');
should(showInformationMessageStub.calledWith(ProjectAlreadyOpened(processPath('/test/folder/folder1/proj2.sqlproj')))).be.true(`showInformationMessage not called with expected message '${ProjectAlreadyOpened(processPath('/test/folder/folder1/proj2.sqlproj'))}' Actual '${showInformationMessageStub.getCall(0).args[0]}'`);
should.strictEqual(updateConfigurationStub.calledWith('projects', sinon.match.array.deepEquals([
processPath('folder1/proj2.sqlproj'),
processPath('proj1.sqlproj'),