mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-25 22:30:29 -04:00
window reuse for connections (#4049)
* window reuse for connections * space after colon * use undefined instead of null
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
/* Disabled pending next vscode merge which allows electron module to be imported during test runs
|
||||
|
||||
'use strict';
|
||||
|
||||
@@ -106,14 +107,13 @@ suite('commandLineService tests', () => {
|
||||
|
||||
function getCommandLineService(connectionManagementService: IConnectionManagementService,
|
||||
configurationService: IWorkspaceConfigurationService,
|
||||
environmentService?: IEnvironmentService,
|
||||
capabilitiesService?: ICapabilitiesService,
|
||||
commandService?: ICommandService
|
||||
): CommandLineService {
|
||||
let service = new CommandLineService(
|
||||
capabilitiesService,
|
||||
connectionManagementService,
|
||||
environmentService,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
@@ -142,7 +142,7 @@ suite('commandLineService tests', () => {
|
||||
.verifiable(TypeMoq.Times.never());
|
||||
const configurationService = getConfigurationServiceMock(true);
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object);
|
||||
service.processCommandLine().then(() => {
|
||||
service.processCommandLine(new TestParsedArgs()).then(() => {
|
||||
connectionManagementService.verifyAll();
|
||||
done();
|
||||
}, error => { assert.fail(error, null, 'processCommandLine rejected ' + error); done(); });
|
||||
@@ -159,7 +159,7 @@ suite('commandLineService tests', () => {
|
||||
const configurationService = getConfigurationServiceMock(false);
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object);
|
||||
|
||||
service.processCommandLine();
|
||||
service.processCommandLine(new TestParsedArgs());
|
||||
connectionManagementService.verifyAll();
|
||||
done();
|
||||
});
|
||||
@@ -175,7 +175,7 @@ suite('commandLineService tests', () => {
|
||||
.verifiable(TypeMoq.Times.never());
|
||||
const configurationService = getConfigurationServiceMock(true);
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object);
|
||||
service.processCommandLine().then(() => {
|
||||
service.processCommandLine(new TestParsedArgs()).then(() => {
|
||||
connectionManagementService.verifyAll();
|
||||
done();
|
||||
}, error => { assert.fail(error, null, 'processCommandLine rejected ' + error); done(); });
|
||||
@@ -185,20 +185,17 @@ suite('commandLineService tests', () => {
|
||||
const connectionManagementService: TypeMoq.Mock<IConnectionManagementService>
|
||||
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
|
||||
|
||||
const environmentService: TypeMoq.Mock<IEnvironmentService> = TypeMoq.Mock.ofType<IEnvironmentService>(EnvironmentService);
|
||||
const args: TestParsedArgs = new TestParsedArgs();
|
||||
args.server = 'myserver';
|
||||
args.database = 'mydatabase';
|
||||
environmentService.setup(e => e.args).returns(() => args).verifiable(TypeMoq.Times.atLeastOnce());
|
||||
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable(TypeMoq.Times.never());
|
||||
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true).verifiable(TypeMoq.Times.atMostOnce());
|
||||
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), 'connection', true))
|
||||
.returns(() => new Promise<string>((resolve, reject) => { resolve('unused'); }))
|
||||
.verifiable(TypeMoq.Times.once());
|
||||
const configurationService = getConfigurationServiceMock(true);
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object, environmentService.object, capabilitiesService);
|
||||
service.processCommandLine().then(() => {
|
||||
environmentService.verifyAll();
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object, capabilitiesService);
|
||||
service.processCommandLine(args).then(() => {
|
||||
connectionManagementService.verifyAll();
|
||||
done();
|
||||
}, error => { assert.fail(error, null, 'processCommandLine rejected ' + error); done(); });
|
||||
@@ -207,12 +204,10 @@ suite('commandLineService tests', () => {
|
||||
test('processCommandLine invokes a command without a profile parameter when no server is passed', done => {
|
||||
const connectionManagementService: TypeMoq.Mock<IConnectionManagementService>
|
||||
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
|
||||
const environmentService: TypeMoq.Mock<IEnvironmentService> = TypeMoq.Mock.ofType<IEnvironmentService>(EnvironmentService);
|
||||
const commandService: TypeMoq.Mock<ICommandService> = TypeMoq.Mock.ofType<ICommandService>(TestCommandService);
|
||||
const args: TestParsedArgs = new TestParsedArgs();
|
||||
|
||||
args.command = 'mycommand';
|
||||
environmentService.setup(e => e.args).returns(() => args);
|
||||
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable(TypeMoq.Times.never());
|
||||
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true).verifiable(TypeMoq.Times.atMostOnce());
|
||||
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
||||
@@ -221,8 +216,8 @@ suite('commandLineService tests', () => {
|
||||
.returns(() => TPromise.wrap(1))
|
||||
.verifiable(TypeMoq.Times.once());
|
||||
const configurationService = getConfigurationServiceMock(true);
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object, environmentService.object, capabilitiesService, commandService.object);
|
||||
service.processCommandLine().then(() => {
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object, capabilitiesService, commandService.object);
|
||||
service.processCommandLine(args).then(() => {
|
||||
connectionManagementService.verifyAll();
|
||||
commandService.verifyAll();
|
||||
done();
|
||||
@@ -235,7 +230,6 @@ suite('commandLineService tests', () => {
|
||||
const connectionManagementService: TypeMoq.Mock<IConnectionManagementService>
|
||||
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
|
||||
|
||||
const environmentService: TypeMoq.Mock<IEnvironmentService> = TypeMoq.Mock.ofType<IEnvironmentService>(EnvironmentService);
|
||||
const commandService: TypeMoq.Mock<ICommandService> = TypeMoq.Mock.ofType<ICommandService>(TestCommandService);
|
||||
const args: TestParsedArgs = new TestParsedArgs();
|
||||
args.command = 'mycommand';
|
||||
@@ -250,8 +244,8 @@ suite('commandLineService tests', () => {
|
||||
.returns(() => TPromise.wrap(1))
|
||||
.verifiable(TypeMoq.Times.once());
|
||||
const configurationService = getConfigurationServiceMock(true);
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object, environmentService.object, capabilitiesService, commandService.object);
|
||||
service.processCommandLine().then(() => {
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object, capabilitiesService, commandService.object);
|
||||
service.processCommandLine(args).then(() => {
|
||||
connectionManagementService.verifyAll();
|
||||
commandService.verifyAll();
|
||||
done();
|
||||
@@ -261,7 +255,6 @@ suite('commandLineService tests', () => {
|
||||
test('processCommandLine rejects unknown commands', done => {
|
||||
const connectionManagementService: TypeMoq.Mock<IConnectionManagementService>
|
||||
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
|
||||
const environmentService: TypeMoq.Mock<IEnvironmentService> = TypeMoq.Mock.ofType<IEnvironmentService>(EnvironmentService);
|
||||
const commandService: TypeMoq.Mock<ICommandService> = TypeMoq.Mock.ofType<ICommandService>(TestCommandService);
|
||||
const args: TestParsedArgs = new TestParsedArgs();
|
||||
|
||||
@@ -272,8 +265,8 @@ suite('commandLineService tests', () => {
|
||||
.returns(() => TPromise.wrapError(new Error('myerror')))
|
||||
.verifiable(TypeMoq.Times.once());
|
||||
const configurationService = getConfigurationServiceMock(true);
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object, environmentService.object, capabilitiesService, commandService.object);
|
||||
service.processCommandLine().then(() => {
|
||||
let service = getCommandLineService(connectionManagementService.object, configurationService.object, capabilitiesService, commandService.object);
|
||||
service.processCommandLine(args).then(() => {
|
||||
assert.fail(1, null, 'processCommandLine should reject when executeCommand errors out');
|
||||
done();
|
||||
}, error => {
|
||||
@@ -282,3 +275,5 @@ suite('commandLineService tests', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user