mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 09:35:36 -05:00
Change target platform of project (#12639)
* Add quick pick to select target platform for a project * add test * show current target platform and info message for new target platform * fix test failing
This commit is contained in:
@@ -19,7 +19,7 @@ import { SqlDatabaseProjectTreeViewProvider } from '../controllers/databaseProje
|
||||
import { ProjectsController } from '../controllers/projectController';
|
||||
import { promises as fs } from 'fs';
|
||||
import { createContext, TestContext, mockDacFxResult } from './testContext';
|
||||
import { Project, reservedProjectFolders, SystemDatabase, FileProjectEntry } from '../models/project';
|
||||
import { Project, reservedProjectFolders, SystemDatabase, FileProjectEntry, SystemDatabaseReferenceProjectEntry } from '../models/project';
|
||||
import { PublishDatabaseDialog } from '../dialogs/publishDatabaseDialog';
|
||||
import { IPublishSettings, IGenerateScriptSettings } from '../models/IPublishSettings';
|
||||
import { exists } from '../common/utils';
|
||||
@@ -253,7 +253,7 @@ describe('ProjectsController', function (): void {
|
||||
proj.addProjectReference({
|
||||
projectName: 'project1',
|
||||
projectGuid: '',
|
||||
projectRelativePath: vscode.Uri.file(path.join('..','project1', 'project1.sqlproj')),
|
||||
projectRelativePath: vscode.Uri.file(path.join('..', 'project1', 'project1.sqlproj')),
|
||||
suppressMissingDependenciesErrors: false
|
||||
});
|
||||
|
||||
@@ -335,6 +335,24 @@ describe('ProjectsController', function (): void {
|
||||
await projController.addItemPrompt(project, '', templates.postDeployScript);
|
||||
should(project.postDeployScripts.length).equal(1, 'Post deploy script should be successfully added');
|
||||
});
|
||||
|
||||
it('Should change target platform', async function (): Promise<void> {
|
||||
sinon.stub(vscode.window, 'showQuickPick').resolves({ label: constants.sqlAzure });
|
||||
|
||||
const projController = new ProjectsController(new SqlDatabaseProjectTreeViewProvider());
|
||||
const sqlProjPath = await testUtils.createTestSqlProjFile(baselines.openProjectFileBaseline);
|
||||
const project = await projController.openProject(vscode.Uri.file(sqlProjPath));
|
||||
should(project.getProjectTargetVersion()).equal(constants.targetPlatformToVersion.get(constants.sqlServer2019));
|
||||
should(project.databaseReferences.length).equal(1, 'Project should have one database reference to master');
|
||||
should(project.databaseReferences[0].fsUri.fsPath).containEql(constants.targetPlatformToVersion.get(constants.sqlServer2019));
|
||||
should((<SystemDatabaseReferenceProjectEntry>project.databaseReferences[0]).ssdtUri.fsPath).containEql(constants.targetPlatformToVersion.get(constants.sqlServer2019));
|
||||
|
||||
await projController.changeTargetPlatform(project);
|
||||
should(project.getProjectTargetVersion()).equal(constants.targetPlatformToVersion.get(constants.sqlAzure));
|
||||
// verify system db reference got updated too
|
||||
should(project.databaseReferences[0].fsUri.fsPath).containEql(constants.targetPlatformToVersion.get(constants.sqlAzure));
|
||||
should((<SystemDatabaseReferenceProjectEntry>project.databaseReferences[0]).ssdtUri.fsPath).containEql(constants.targetPlatformToVersion.get(constants.sqlAzure));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Publishing and script generation', function (): void {
|
||||
|
||||
Reference in New Issue
Block a user