mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
Auto increment new db project name (#11882)
* auto increment db proj name * auto increment on import project from db * adding separate message if workspace setting is invalid * updating based on feedback * adding do not ask again functionality * moving constants * making newprojecttool only top level functions * adding tests * updating to address merge conflicts * fixing tests * fixing tests
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as should from 'should';
|
||||
import * as newProjectTool from '../tools/newProjectTool';
|
||||
import * as constants from '../common/constants';
|
||||
import { generateTestFolderPath, createTestFile } from './testUtils';
|
||||
|
||||
let previousSetting : string;
|
||||
let testFolderPath : string;
|
||||
|
||||
describe('NewProjectTool: New project tool tests', function (): void {
|
||||
beforeEach(async function () {
|
||||
previousSetting = await vscode.workspace.getConfiguration(constants.dbProjectConfigurationKey)[constants.projectSaveLocationKey];
|
||||
testFolderPath = await generateTestFolderPath();
|
||||
});
|
||||
|
||||
afterEach(async function () {
|
||||
await vscode.workspace.getConfiguration(constants.dbProjectConfigurationKey).update(constants.projectSaveLocationKey, previousSetting, true);
|
||||
});
|
||||
|
||||
it('Should generate correct default project names', async function (): Promise<void> {
|
||||
await vscode.workspace.getConfiguration(constants.dbProjectConfigurationKey).update(constants.projectSaveLocationKey, testFolderPath, true);
|
||||
should(newProjectTool.defaultProjectNameNewProj()).equal('DatabaseProject1');
|
||||
should(newProjectTool.defaultProjectNameFromDb('master')).equal('DatabaseProjectmaster');
|
||||
});
|
||||
|
||||
it('Should auto-increment default project names for new projects', async function (): Promise<void> {
|
||||
await vscode.workspace.getConfiguration(constants.dbProjectConfigurationKey).update(constants.projectSaveLocationKey, testFolderPath, true);
|
||||
should(newProjectTool.defaultProjectNameNewProj()).equal('DatabaseProject1');
|
||||
|
||||
await createTestFile('', 'DatabaseProject1', testFolderPath);
|
||||
should(newProjectTool.defaultProjectNameNewProj()).equal('DatabaseProject2');
|
||||
|
||||
await createTestFile('', 'DatabaseProject2', testFolderPath);
|
||||
should(newProjectTool.defaultProjectNameNewProj()).equal('DatabaseProject3');
|
||||
});
|
||||
|
||||
it('Should auto-increment default project names for import projects', async function (): Promise<void> {
|
||||
await vscode.workspace.getConfiguration(constants.dbProjectConfigurationKey).update(constants.projectSaveLocationKey, testFolderPath, true);
|
||||
should(newProjectTool.defaultProjectNameFromDb("master")).equal('DatabaseProjectmaster');
|
||||
|
||||
await createTestFile('', 'DatabaseProjectmaster', testFolderPath);
|
||||
should(newProjectTool.defaultProjectNameFromDb("master")).equal('DatabaseProjectmaster2');
|
||||
|
||||
await createTestFile('', 'DatabaseProjectmaster2', testFolderPath);
|
||||
should(newProjectTool.defaultProjectNameFromDb("master")).equal('DatabaseProjectmaster3');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user