Renable Strict TSLint (#5018)

* removes more builder references

* remove builder from profiler

* formatting

* fix profiler dailog

* remove builder from oatuhdialog

* remove the rest of builder references

* formatting

* add more strict null checks to base

* enable strict tslint rules

* fix formatting

* fix compile error

* fix the rest of the hygeny issues and add pipeline step

* fix pipeline files
This commit is contained in:
Anthony Dresser
2019-04-18 00:34:53 -07:00
committed by GitHub
parent b852f032d3
commit ddd89fc52a
431 changed files with 3147 additions and 3789 deletions

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import * as TypeMoq from 'typemoq';
import * as azdata from 'azdata';
@@ -178,7 +176,7 @@ suite('commandLineService tests', () => {
try {
await service.processCommandLine(new TestParsedArgs());
connectionManagementService.verifyAll();
} catch (error){
} catch (error) {
assert.fail(error, null, 'processCommandLine rejected ' + error);
}
});
@@ -316,22 +314,22 @@ suite('commandLineService tests', () => {
const connectionManagementService: TypeMoq.Mock<IConnectionManagementService>
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
var connection = new ConnectionProfile(capabilitiesService, {
connectionName: 'Test',
savePassword: false,
groupFullName: 'testGroup',
serverName: 'myserver',
databaseName: 'mydatabase',
authenticationType: Constants.integrated,
password: undefined,
userName: '',
groupId: undefined,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: 'testID'
});
var conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined);
let connection = new ConnectionProfile(capabilitiesService, {
connectionName: 'Test',
savePassword: false,
groupFullName: 'testGroup',
serverName: 'myserver',
databaseName: 'mydatabase',
authenticationType: Constants.integrated,
password: undefined,
userName: '',
groupId: undefined,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: 'testID'
});
let conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined);
conProfGroup.connections = [connection];
const args: TestParsedArgs = new TestParsedArgs();
args.server = 'myserver';

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as OptionsDialogHelper from 'sql/workbench/browser/modal/optionsDialogHelper';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import * as azdata from 'azdata';
@@ -13,18 +12,18 @@ import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
import { $ } from 'vs/base/browser/dom';
suite('Advanced options helper tests', () => {
var possibleInputs: string[];
let possibleInputs: string[];
let options: { [name: string]: any };
var categoryOption: azdata.ServiceOption;
var booleanOption: azdata.ServiceOption;
var numberOption: azdata.ServiceOption;
var stringOption: azdata.ServiceOption;
var defaultGroupOption: azdata.ServiceOption;
var isValid: boolean;
var inputValue: string;
var inputBox: TypeMoq.Mock<InputBox>;
let categoryOption: azdata.ServiceOption;
let booleanOption: azdata.ServiceOption;
let numberOption: azdata.ServiceOption;
let stringOption: azdata.ServiceOption;
let defaultGroupOption: azdata.ServiceOption;
let isValid: boolean;
let inputValue: string;
let inputBox: TypeMoq.Mock<InputBox>;
var optionsMap: { [optionName: string]: OptionsDialogHelper.IOptionElement };
let optionsMap: { [optionName: string]: OptionsDialogHelper.IOptionElement };
setup(() => {
options = {};
@@ -108,7 +107,7 @@ suite('Advanced options helper tests', () => {
categoryOption.defaultValue = 'ReadWrite';
categoryOption.isRequired = false;
possibleInputs = [];
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, 'ReadWrite');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0], '');
@@ -120,7 +119,7 @@ suite('Advanced options helper tests', () => {
categoryOption.defaultValue = 'ReadWrite';
categoryOption.isRequired = true;
possibleInputs = [];
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, 'ReadWrite');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0], 'ReadWrite');
@@ -131,7 +130,7 @@ suite('Advanced options helper tests', () => {
categoryOption.defaultValue = null;
categoryOption.isRequired = false;
possibleInputs = [];
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, '');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0], '');
@@ -143,7 +142,7 @@ suite('Advanced options helper tests', () => {
categoryOption.defaultValue = null;
categoryOption.isRequired = true;
possibleInputs = [];
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, 'ReadWrite');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0], 'ReadWrite');
@@ -155,7 +154,7 @@ suite('Advanced options helper tests', () => {
categoryOption.isRequired = false;
possibleInputs = [];
options['applicationIntent'] = 'ReadOnly';
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, 'ReadOnly');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0], '');
@@ -168,7 +167,7 @@ suite('Advanced options helper tests', () => {
categoryOption.isRequired = true;
possibleInputs = [];
options['applicationIntent'] = 'ReadOnly';
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, 'ReadOnly');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0], 'ReadWrite');
@@ -179,7 +178,7 @@ suite('Advanced options helper tests', () => {
booleanOption.defaultValue = 'False';
booleanOption.isRequired = false;
possibleInputs = [];
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, 'False');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0], '');
@@ -191,7 +190,7 @@ suite('Advanced options helper tests', () => {
booleanOption.defaultValue = 'False';
booleanOption.isRequired = true;
possibleInputs = [];
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, 'False');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0], 'True');
@@ -202,7 +201,7 @@ suite('Advanced options helper tests', () => {
booleanOption.defaultValue = null;
booleanOption.isRequired = false;
possibleInputs = [];
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, '');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0], '');
@@ -214,7 +213,7 @@ suite('Advanced options helper tests', () => {
booleanOption.defaultValue = null;
booleanOption.isRequired = true;
possibleInputs = [];
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, 'True');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0], 'True');
@@ -226,7 +225,7 @@ suite('Advanced options helper tests', () => {
booleanOption.isRequired = false;
possibleInputs = [];
options['asynchronousProcessing'] = true;
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, 'True');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0], '');
@@ -239,7 +238,7 @@ suite('Advanced options helper tests', () => {
booleanOption.isRequired = true;
possibleInputs = [];
options['asynchronousProcessing'] = 'False';
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, 'False');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0], 'True');
@@ -250,7 +249,7 @@ suite('Advanced options helper tests', () => {
numberOption.defaultValue = '15';
numberOption.isRequired = true;
possibleInputs = [];
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(numberOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(numberOption, options, possibleInputs);
assert.equal(optionValue, '15');
});
@@ -259,7 +258,7 @@ suite('Advanced options helper tests', () => {
numberOption.isRequired = false;
possibleInputs = [];
options['connectTimeout'] = '45';
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(numberOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(numberOption, options, possibleInputs);
assert.equal(optionValue, '45');
});
@@ -267,7 +266,7 @@ suite('Advanced options helper tests', () => {
stringOption.defaultValue = 'Japanese';
stringOption.isRequired = true;
possibleInputs = [];
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(stringOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(stringOption, options, possibleInputs);
assert.equal(optionValue, 'Japanese');
});
@@ -276,7 +275,7 @@ suite('Advanced options helper tests', () => {
stringOption.isRequired = false;
possibleInputs = [];
options['currentLanguage'] = 'Spanish';
var optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(stringOption, options, possibleInputs);
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(stringOption, options, possibleInputs);
assert.equal(optionValue, 'Spanish');
});
@@ -291,7 +290,7 @@ suite('Advanced options helper tests', () => {
optionValue: null
};
var error = OptionsDialogHelper.validateInputs(optionsMap);
let error = OptionsDialogHelper.validateInputs(optionsMap);
assert.equal(error, true);
});
@@ -306,7 +305,7 @@ suite('Advanced options helper tests', () => {
optionValue: null
};
var error = OptionsDialogHelper.validateInputs(optionsMap);
let error = OptionsDialogHelper.validateInputs(optionsMap);
assert.equal(error, true);
});
@@ -320,7 +319,7 @@ suite('Advanced options helper tests', () => {
option: numberOption,
optionValue: null
};
var error = OptionsDialogHelper.validateInputs(optionsMap);
let error = OptionsDialogHelper.validateInputs(optionsMap);
assert.equal(error, true);
});
@@ -335,7 +334,7 @@ suite('Advanced options helper tests', () => {
optionValue: null
};
var error = OptionsDialogHelper.validateInputs(optionsMap);
let error = OptionsDialogHelper.validateInputs(optionsMap);
assert.equal(error, false);
});
@@ -350,7 +349,7 @@ suite('Advanced options helper tests', () => {
optionValue: null
};
var error = OptionsDialogHelper.validateInputs(optionsMap);
let error = OptionsDialogHelper.validateInputs(optionsMap);
assert.equal(error, false);
});

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { OptionsDialog } from 'sql/workbench/browser/modal/optionsDialog';
import { AdvancedPropertiesController } from 'sql/workbench/parts/connection/browser/advancedPropertiesController';
import { ContextKeyServiceStub } from 'sqltest/stubs/contextKeyServiceStub';
@@ -14,8 +13,8 @@ import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
import { $ } from 'vs/base/browser/dom';
suite('Advanced properties dialog tests', () => {
var advancedController: AdvancedPropertiesController;
var providerOptions: azdata.ConnectionOption[];
let advancedController: AdvancedPropertiesController;
let providerOptions: azdata.ConnectionOption[];
setup(() => {
advancedController = new AdvancedPropertiesController(() => { }, null);
@@ -84,7 +83,7 @@ suite('Advanced properties dialog tests', () => {
});
test('advanced dialog should open when showDialog in advancedController get called', () => {
var isAdvancedDialogCalled = false;
let isAdvancedDialogCalled = false;
let options: { [name: string]: any } = {};
let advanceDialog = TypeMoq.Mock.ofType(OptionsDialog, TypeMoq.MockBehavior.Strict,
'', // title

View File

@@ -106,10 +106,10 @@ suite('SQL ConnectionManagementService tests', () => {
c => c.serverName === connectionProfile.serverName))).returns(() => Promise.resolve({ profile: connectionProfile, savedCred: true }));
connectionStore.setup(x => x.addSavedPassword(TypeMoq.It.is<IConnectionProfile>(
c => c.serverName === connectionProfileWithEmptySavedPassword.serverName))).returns(
() => Promise.resolve({ profile: connectionProfileWithEmptySavedPassword, savedCred: true }));
() => Promise.resolve({ profile: connectionProfileWithEmptySavedPassword, savedCred: true }));
connectionStore.setup(x => x.addSavedPassword(TypeMoq.It.is<IConnectionProfile>(
c => c.serverName === connectionProfileWithEmptyUnsavedPassword.serverName))).returns(
() => Promise.resolve({ profile: connectionProfileWithEmptyUnsavedPassword, savedCred: false }));
() => Promise.resolve({ profile: connectionProfileWithEmptyUnsavedPassword, savedCred: false }));
connectionStore.setup(x => x.isPasswordRequired(TypeMoq.It.isAny())).returns(() => true);
connectionStore.setup(x => x.getConnectionProfileGroups(false, undefined)).returns(() => [root]);

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as TypeMoq from 'typemoq';
import * as assert from 'assert';
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
@@ -108,7 +106,7 @@ suite('SQL Connection Tree Action tests', () => {
let manageConnectionAction: ManageConnectionAction = new ManageConnectionAction(ManageConnectionAction.ID,
ManageConnectionAction.LABEL, undefined, connectionManagementService.object, capabilitiesService, instantiationService.object, objectExplorerService.object);
var actionContext = new ObjectExplorerActionsContext();
let actionContext = new ObjectExplorerActionsContext();
actionContext.connectionProfile = connection.toIConnectionProfile();
actionContext.isConnectionNode = true;
manageConnectionAction.run(actionContext).then((value) => {
@@ -146,7 +144,7 @@ suite('SQL Connection Tree Action tests', () => {
let manageConnectionAction: ManageConnectionAction = new ManageConnectionAction(ManageConnectionAction.ID,
ManageConnectionAction.LABEL, undefined, connectionManagementService.object, capabilitiesService, instantiationService.object, objectExplorerService.object);
var actionContext = new ObjectExplorerActionsContext();
let actionContext = new ObjectExplorerActionsContext();
actionContext.connectionProfile = connection.toIConnectionProfile();
actionContext.nodeInfo = treeNode.toNodeInfo();
manageConnectionAction.run(actionContext).then((value) => {
@@ -177,7 +175,7 @@ suite('SQL Connection Tree Action tests', () => {
let changeConnectionAction: DisconnectConnectionAction = new DisconnectConnectionAction(DisconnectConnectionAction.ID, DisconnectConnectionAction.LABEL, connection, connectionManagementService.object, objectExplorerService.object, errorMessageService.object);
var actionContext = new ObjectExplorerActionsContext();
let actionContext = new ObjectExplorerActionsContext();
actionContext.connectionProfile = connection.toIConnectionProfile();
changeConnectionAction.run(actionContext).then((value) => {
connectionManagementService.verify(x => x.isProfileConnected(TypeMoq.It.isAny()), TypeMoq.Times.atLeastOnce());
@@ -348,7 +346,7 @@ suite('SQL Connection Tree Action tests', () => {
capabilitiesService.capabilities['MSSQL'] = { connection: sqlProvider };
var connection = new ConnectionProfile(capabilitiesService, {
let connection = new ConnectionProfile(capabilitiesService, {
connectionName: 'Test',
savePassword: false,
groupFullName: 'testGroup',
@@ -363,9 +361,9 @@ suite('SQL Connection Tree Action tests', () => {
saveProfile: true,
id: 'testID'
});
var conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined);
let conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined);
conProfGroup.connections = [connection];
var connectionManagementService = TypeMoq.Mock.ofType(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
let connectionManagementService = TypeMoq.Mock.ofType(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
connectionManagementService.callBase = true;
connectionManagementService.setup(x => x.getConnectionGroups()).returns(() => [conProfGroup]);
connectionManagementService.setup(x => x.getActiveConnections()).returns(() => [connection]);
@@ -374,7 +372,7 @@ suite('SQL Connection Tree Action tests', () => {
}));
connectionManagementService.setup(x => x.isConnected(undefined, TypeMoq.It.isAny())).returns(() => isConnectedReturnValue);
var objectExplorerSession = {
let objectExplorerSession = {
success: true,
sessionId: '1234',
rootNode: {
@@ -390,17 +388,17 @@ suite('SQL Connection Tree Action tests', () => {
errorMessage: ''
};
var tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
let tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
tablesNode.connection = connection;
tablesNode.session = objectExplorerSession;
var table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
var table2Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
let table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
let table2Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
tablesNode.children = [table1Node, table2Node];
let objectExplorerService = TypeMoq.Mock.ofType(ObjectExplorerService, TypeMoq.MockBehavior.Loose, connectionManagementService.object);
objectExplorerService.callBase = true;
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => tablesNode);
objectExplorerService.setup(x => x.refreshTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([table1Node, table2Node]));
var dataSource = new ServerTreeDataSource(objectExplorerService.object, connectionManagementService.object, undefined);
let dataSource = new ServerTreeDataSource(objectExplorerService.object, connectionManagementService.object, undefined);
let tree = TypeMoq.Mock.ofType(Tree, TypeMoq.MockBehavior.Loose, $('div'), { dataSource });
tree.callBase = true;
@@ -436,7 +434,7 @@ suite('SQL Connection Tree Action tests', () => {
capabilitiesService.capabilities['MSSQL'] = { connection: sqlProvider };
var connection = new ConnectionProfile(capabilitiesService, {
let connection = new ConnectionProfile(capabilitiesService, {
connectionName: 'Test',
savePassword: false,
groupFullName: 'testGroup',
@@ -451,9 +449,9 @@ suite('SQL Connection Tree Action tests', () => {
saveProfile: true,
id: 'testID'
});
var conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined);
let conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined);
conProfGroup.connections = [connection];
var connectionManagementService = TypeMoq.Mock.ofType(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
let connectionManagementService = TypeMoq.Mock.ofType(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
connectionManagementService.callBase = true;
connectionManagementService.setup(x => x.getConnectionGroups()).returns(() => [conProfGroup]);
connectionManagementService.setup(x => x.getActiveConnections()).returns(() => [connection]);
@@ -462,7 +460,7 @@ suite('SQL Connection Tree Action tests', () => {
}));
connectionManagementService.setup(x => x.isConnected(undefined, TypeMoq.It.isAny())).returns(() => isConnectedReturnValue);
var objectExplorerSession = {
let objectExplorerSession = {
success: true,
sessionId: '1234',
rootNode: {
@@ -478,17 +476,17 @@ suite('SQL Connection Tree Action tests', () => {
errorMessage: ''
};
var tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
let tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
tablesNode.connection = connection;
tablesNode.session = objectExplorerSession;
var table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
var table2Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
let table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
let table2Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
tablesNode.children = [table1Node, table2Node];
let objectExplorerService = TypeMoq.Mock.ofType(ObjectExplorerService, TypeMoq.MockBehavior.Loose, connectionManagementService.object);
objectExplorerService.callBase = true;
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => tablesNode);
objectExplorerService.setup(x => x.refreshTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([table1Node, table2Node]));
var dataSource = new ServerTreeDataSource(objectExplorerService.object, connectionManagementService.object, undefined);
let dataSource = new ServerTreeDataSource(objectExplorerService.object, connectionManagementService.object, undefined);
let tree = TypeMoq.Mock.ofType(Tree, TypeMoq.MockBehavior.Loose, $('div'), { dataSource });
tree.callBase = true;

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { ObjectExplorerProviderTestService } from 'sqltest/stubs/objectExplorerProviderTestService';
import { TestConnectionManagementService } from 'sqltest/stubs/connectionManagementService.test';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
@@ -21,7 +20,7 @@ import { Event, Emitter } from 'vs/base/common/event';
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
suite('SQL Object Explorer Service tests', () => {
var sqlOEProvider: TypeMoq.Mock<ObjectExplorerProviderTestService>;
let sqlOEProvider: TypeMoq.Mock<ObjectExplorerProviderTestService>;
let connectionManagementService: TypeMoq.Mock<TestConnectionManagementService>;
let connection: ConnectionProfile;
let connectionToFail: ConnectionProfile;
@@ -352,7 +351,7 @@ suite('SQL Object Explorer Service tests', () => {
assert.equal(expandInfo !== null || expandInfo !== undefined, true);
assert.equal(expandInfo.sessionId, '1234');
assert.equal(expandInfo.nodes.length, 2);
var children = expandInfo.nodes;
let children = expandInfo.nodes;
assert.equal(children[0].label, 'dbo.Table1');
assert.equal(children[1].label, 'dbo.Table2');
done();
@@ -370,7 +369,7 @@ suite('SQL Object Explorer Service tests', () => {
assert.equal(expandInfo !== null || expandInfo !== undefined, true);
assert.equal(expandInfo.sessionId, '1234');
assert.equal(expandInfo.nodes.length, 2);
var children = expandInfo.nodes;
let children = expandInfo.nodes;
assert.equal(children[0].label, 'dbo.Table1');
assert.equal(children[1].label, 'dbo.Table3');
done();
@@ -382,7 +381,7 @@ suite('SQL Object Explorer Service tests', () => {
});
test('expand tree node should get correct children', (done) => {
var tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
let tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
tablesNode.connection = connection;
objectExplorerService.createNewSession('MSSQL', connection).then(result => {
objectExplorerService.onSessionCreated(1, objectExplorerSession);
@@ -403,7 +402,7 @@ suite('SQL Object Explorer Service tests', () => {
});
test('refresh tree node should children correctly', (done) => {
var tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
let tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
tablesNode.connection = connection;
objectExplorerService.createNewSession('MSSQL', connection).then(result => {
objectExplorerService.onSessionCreated(1, objectExplorerSession);
@@ -427,7 +426,7 @@ suite('SQL Object Explorer Service tests', () => {
objectExplorerService.createNewSession('MSSQL', connection).then(result => {
objectExplorerService.onSessionCreated(1, objectExplorerSession);
objectExplorerService.updateObjectExplorerNodes(connection).then(() => {
var treeNode = objectExplorerService.getObjectExplorerNode(connection);
let treeNode = objectExplorerService.getObjectExplorerNode(connection);
assert.equal(treeNode !== null || treeNode !== undefined, true);
assert.equal(treeNode.getSession(), objectExplorerSession);
assert.equal(treeNode.getConnectionProfile(), connection);
@@ -445,7 +444,7 @@ suite('SQL Object Explorer Service tests', () => {
objectExplorerService.createNewSession('MSSQL', connection).then(result => {
objectExplorerService.onSessionCreated(1, objectExplorerSession);
objectExplorerService.updateObjectExplorerNodes(connection).then(() => {
var treeNode = objectExplorerService.getObjectExplorerNode(connection);
let treeNode = objectExplorerService.getObjectExplorerNode(connection);
assert.equal(treeNode !== null && treeNode !== undefined, true);
objectExplorerService.deleteObjectExplorerNode(connection).then(() => {
treeNode = objectExplorerService.getObjectExplorerNode(connection);
@@ -460,20 +459,20 @@ suite('SQL Object Explorer Service tests', () => {
});
test('children tree nodes should return correct object explorer session, connection profile and database name', () => {
var databaseMetaData = {
let databaseMetaData = {
metadataType: 0,
metadataTypeName: 'Database',
urn: '//server/db1/',
name: 'Db1',
schema: null
};
var databaseNode = new TreeNode(NodeType.Database, 'Db1', false, 'testServerName\\Db1', '', '', null, databaseMetaData, undefined, undefined);
let databaseNode = new TreeNode(NodeType.Database, 'Db1', false, 'testServerName\\Db1', '', '', null, databaseMetaData, undefined, undefined);
databaseNode.connection = connection;
databaseNode.session = objectExplorerSession;
var tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\\Db1\\tables', '', '', databaseNode, null, undefined, undefined);
let tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\\Db1\\tables', '', '', databaseNode, null, undefined, undefined);
databaseNode.children = [tablesNode];
var table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\\Db1\\tables\\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
var table2Node = new TreeNode(NodeType.Table, 'dbo.Table2', false, 'testServerName\\Db1\\tables\\dbo.Table2', '', '', tablesNode, null, undefined, undefined);
let table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\\Db1\\tables\\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
let table2Node = new TreeNode(NodeType.Table, 'dbo.Table2', false, 'testServerName\\Db1\\tables\\dbo.Table2', '', '', tablesNode, null, undefined, undefined);
tablesNode.children = [table1Node, table2Node];
assert.equal(table1Node.getSession(), objectExplorerSession);
assert.equal(table1Node.getConnectionProfile(), connection);
@@ -796,4 +795,4 @@ suite('SQL Object Explorer Service tests', () => {
// Then refresh gets called on the node
sqlOEProvider.verify(x => x.refreshNode(TypeMoq.It.is(x => x.nodePath === tablesNodePath)), TypeMoq.Times.once());
});
});
});

View File

@@ -49,7 +49,7 @@ suite('Data Explorer Viewlet', () => {
let oldCount = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length;
let d = new ViewletDescriptor(DataExplorerTestViewlet, 'dataExplorer-test-id', 'name');
Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).registerViewlet(d);
let retrieved = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlet('dataExplorer-test-id');
let retrieved = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlet('dataExplorer-test-id');
assert(d === retrieved);
let newCount = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length;
assert.equal(oldCount + 1, newCount);

View File

@@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { InsightsDialogController } from 'sql/workbench/services/insights/node/insightsDialogController';
import { InsightsDialogModel } from 'sql/workbench/services/insights/common/insightsDialogModel';

View File

@@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { equal, fail } from 'assert';
import * as os from 'os';
@@ -134,7 +134,7 @@ suite('Insights Utils tests', function () {
new Workspace(
'TestWorkspace',
[toWorkspaceFolder(URI.file(os.tmpdir()))])
);
);
const configurationResolverService = new ConfigurationResolverService(
undefined,
new TestEnvironmentService({}),

View File

@@ -1,11 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as should from 'should';
import * as TypeMoq from 'typemoq';
import { nb } from 'azdata';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as should from 'should';
import * as TypeMoq from 'typemoq';
import { nb } from 'azdata';
@@ -14,7 +12,6 @@ import { TestNotificationService } from 'vs/platform/notification/test/common/te
import { URI } from 'vs/base/common/uri';
import { LocalContentManager } from 'sql/workbench/services/notebook/node/localContentManager';
import * as testUtils from '../../../utils/testUtils';
import { NotebookManagerStub } from '../common';
import { NotebookModel } from 'sql/workbench/parts/notebook/models/notebookModel';
import { ModelFactory } from 'sql/workbench/parts/notebook/models/modelFactory';
@@ -201,7 +198,7 @@ suite('notebook model', function (): void {
// should(sessionFired).be.false();
// });
test('Should not be in error state if client session initialization succeeds', async function(): Promise<void> {
test('Should not be in error state if client session initialization succeeds', async function (): Promise<void> {
let mockContentManager = TypeMoq.Mock.ofType(LocalContentManager);
mockContentManager.setup(c => c.getNotebookContents(TypeMoq.It.isAny())).returns(() => Promise.resolve(expectedNotebookContentOneCell));
notebookManagers[0].contentManager = mockContentManager.object;
@@ -218,7 +215,7 @@ suite('notebook model', function (): void {
sessionReady.resolve();
let actualSession: IClientSession = undefined;
let options: INotebookModelOptions = Object.assign({}, defaultModelOptions, <Partial<INotebookModelOptions>> {
let options: INotebookModelOptions = Object.assign({}, defaultModelOptions, <Partial<INotebookModelOptions>>{
factory: mockModelFactory.object
});
let model = new NotebookModel(options, undefined);
@@ -238,7 +235,7 @@ suite('notebook model', function (): void {
should(model.clientSession).equal(mockClientSession.object);
});
test('Should sanitize kernel display name when IP is included', async function(): Promise<void> {
test('Should sanitize kernel display name when IP is included', async function (): Promise<void> {
let model = new NotebookModel(defaultModelOptions);
let displayName = 'PySpark (1.1.1.1)';
let sanitizedDisplayName = model.sanitizeDisplayName(displayName);

View File

@@ -3,86 +3,84 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as should from 'should';
import { nb, IConnectionProfile } from 'azdata';
import { IConnectionProfile } from 'azdata';
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { formatServerNameWithDatabaseNameForAttachTo, getServerFromFormattedAttachToName, getDatabaseFromFormattedAttachToName } from 'sql/workbench/parts/notebook/notebookUtils';
suite('notebookUtils', function(): void {
let conn: IConnectionProfile = {
connectionName: '',
serverName: '',
databaseName: '',
userName: '',
password: '',
authenticationType: '',
savePassword: true,
groupFullName: '',
groupId: '',
providerName: '',
saveProfile: true,
id: '',
options: {},
azureTenantId: undefined
};
suite('notebookUtils', function (): void {
let conn: IConnectionProfile = {
connectionName: '',
serverName: '',
databaseName: '',
userName: '',
password: '',
authenticationType: '',
savePassword: true,
groupFullName: '',
groupId: '',
providerName: '',
saveProfile: true,
id: '',
options: {},
azureTenantId: undefined
};
test('Should format server and database name correctly for attach to', async function(): Promise<void> {
let capabilitiesService = new CapabilitiesTestService();
let connProfile = new ConnectionProfile(capabilitiesService, conn);
connProfile.serverName = 'serverName';
connProfile.databaseName = 'databaseName';
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
should(attachToNameFormatted).equal('serverName (databaseName)');
});
test('Should format server and database name correctly for attach to', async function (): Promise<void> {
let capabilitiesService = new CapabilitiesTestService();
let connProfile = new ConnectionProfile(capabilitiesService, conn);
connProfile.serverName = 'serverName';
connProfile.databaseName = 'databaseName';
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
should(attachToNameFormatted).equal('serverName (databaseName)');
});
test('Should format server name correctly for attach to', async function(): Promise<void> {
let capabilitiesService = new CapabilitiesTestService();
let connProfile = new ConnectionProfile(capabilitiesService, conn);
connProfile.serverName = 'serverName';
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
should(attachToNameFormatted).equal('serverName');
});
test('Should format server name correctly for attach to', async function (): Promise<void> {
let capabilitiesService = new CapabilitiesTestService();
let connProfile = new ConnectionProfile(capabilitiesService, conn);
connProfile.serverName = 'serverName';
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
should(attachToNameFormatted).equal('serverName');
});
test('Should format server name correctly for attach to when database is undefined', async function(): Promise<void> {
let capabilitiesService = new CapabilitiesTestService();
let connProfile = new ConnectionProfile(capabilitiesService, conn);
connProfile.serverName = 'serverName';
connProfile.databaseName = undefined;
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
should(attachToNameFormatted).equal('serverName');
});
test('Should format server name correctly for attach to when database is undefined', async function (): Promise<void> {
let capabilitiesService = new CapabilitiesTestService();
let connProfile = new ConnectionProfile(capabilitiesService, conn);
connProfile.serverName = 'serverName';
connProfile.databaseName = undefined;
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
should(attachToNameFormatted).equal('serverName');
});
test('Should format server name as empty string when server/database are undefined', async function(): Promise<void> {
let capabilitiesService = new CapabilitiesTestService();
let connProfile = new ConnectionProfile(capabilitiesService, conn);
connProfile.serverName = undefined;
connProfile.databaseName = undefined;
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
should(attachToNameFormatted).equal('');
});
test('Should format server name as empty string when server/database are undefined', async function (): Promise<void> {
let capabilitiesService = new CapabilitiesTestService();
let connProfile = new ConnectionProfile(capabilitiesService, conn);
connProfile.serverName = undefined;
connProfile.databaseName = undefined;
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
should(attachToNameFormatted).equal('');
});
test('Should extract server name when no database specified', async function(): Promise<void> {
let serverName = getServerFromFormattedAttachToName('serverName');
let databaseName = getDatabaseFromFormattedAttachToName('serverName');
should(serverName).equal('serverName');
should(databaseName).equal('');
});
test('Should extract server name when no database specified', async function (): Promise<void> {
let serverName = getServerFromFormattedAttachToName('serverName');
let databaseName = getDatabaseFromFormattedAttachToName('serverName');
should(serverName).equal('serverName');
should(databaseName).equal('');
});
test('Should extract server and database name', async function(): Promise<void> {
let serverName = getServerFromFormattedAttachToName('serverName (databaseName)');
let databaseName = getDatabaseFromFormattedAttachToName('serverName (databaseName)');
should(serverName).equal('serverName');
should(databaseName).equal('databaseName');
});
test('Should extract server and database name', async function (): Promise<void> {
let serverName = getServerFromFormattedAttachToName('serverName (databaseName)');
let databaseName = getDatabaseFromFormattedAttachToName('serverName (databaseName)');
should(serverName).equal('serverName');
should(databaseName).equal('databaseName');
});
test('Should extract server and database name with other parentheses', async function(): Promise<void> {
let serverName = getServerFromFormattedAttachToName('serv()erName (databaseName)');
let databaseName = getDatabaseFromFormattedAttachToName('serv()erName (databaseName)');
should(serverName).equal('serv()erName');
should(databaseName).equal('databaseName');
});
test('Should extract server and database name with other parentheses', async function (): Promise<void> {
let serverName = getServerFromFormattedAttachToName('serv()erName (databaseName)');
let databaseName = getDatabaseFromFormattedAttachToName('serv()erName (databaseName)');
should(serverName).equal('serv()erName');
should(databaseName).equal('databaseName');
});
});

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo';
import { ICapabilitiesService, ProviderFeatures } from 'sql/platform/capabilities/common/capabilitiesService';
@@ -120,7 +119,6 @@ export class CapabilitiesTestService implements ICapabilitiesService {
/**
* Register the capabilities provider and query the provider for its capabilities
* @param provider
*/
public registerProvider(provider: azdata.CapabilitiesProvider): void {
}
@@ -145,4 +143,3 @@ export class CapabilitiesTestService implements ICapabilitiesService {
private _onCapabilitiesRegistered = new Emitter<ProviderFeatures>();
public readonly onCapabilitiesRegistered = this._onCapabilitiesRegistered.event;
}

View File

@@ -142,7 +142,7 @@ export class EditorGroupTestService implements IEditorGroupsService {
/**
* Keyboard focus the editor group at the provided position.
*/
public focusGroup(group: EditorGroup): void;
public focusGroup(group: EditorGroup): void;
public focusGroup(position: Position): void;
public focusGroup(arg1: any) {
return;

View File

@@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as platform from 'vs/base/common/platform';
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';

View File

@@ -5,7 +5,7 @@
'use strict';
import { IEditorService, SIDE_GROUP_TYPE, ACTIVE_GROUP_TYPE, IResourceEditor, IResourceEditorReplacement, IOpenEditorOverrideHandler } from 'vs/workbench/services/editor/common/editorService';
import { ServiceIdentifier, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IEditorOptions, IResourceInput, ITextEditorOptions } from 'vs/platform/editor/common/editor';
import { IEditorOptions, IResourceInput, ITextEditorOptions } from 'vs/platform/editor/common/editor';
import { IEditor, IEditorInput, IResourceDiffInput, IResourceSideBySideInput, GroupIdentifier, ITextEditor, IUntitledResourceInput, ITextDiffEditor, ITextSideBySideEditor, IEditorInputWithOptions } from 'vs/workbench/common/editor';
import { Event } from 'vs/base/common/event';
import { Position } from 'vs/editor/common/core/position';
@@ -49,7 +49,7 @@ export class WorkbenchEditorTestService implements IEditorService {
public openEditor(editor: IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise<ITextEditor>;
public openEditor(editor: IResourceDiffInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise<ITextDiffEditor>;
public openEditor(editor: IResourceSideBySideInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise<ITextSideBySideEditor>;
public openEditor(input: any, arg2?: any, arg3?: any): Promise<IEditor> {
public openEditor(input: any, arg2?: any, arg3?: any): Promise<IEditor> {
return undefined;
}

View File

@@ -1,22 +1,19 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
export async function assertThrowsAsync(fn, expectedMessage?: string): Promise<void> {
var threw = false;
try {
await fn();
} catch (e) {
threw = true;
if (expectedMessage) {
assert.strictEqual(e.message, expectedMessage);
}
}
assert.equal(threw, true, 'Expected function to throw but it did not');
let threw = false;
try {
await fn();
} catch (e) {
threw = true;
if (expectedMessage) {
assert.strictEqual(e.message, expectedMessage);
}
}
assert.equal(threw, true, 'Expected function to throw but it did not');
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import { TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
@@ -116,18 +114,18 @@ suite('ExtHostCredentialManagement', () => {
// Then: I should get an error
extHost.$getCredentialProvider(undefined)
.then(
() => { done('Provider was returned from undefined'); },
() => { /* Swallow error, this is success path */ }
() => { done('Provider was returned from undefined'); },
() => { /* Swallow error, this is success path */ }
)
.then(() => { return extHost.$getCredentialProvider(null); })
.then(
() => { done('Provider was returned from null'); },
() => { /* Swallow error, this is success path */ }
() => { done('Provider was returned from null'); },
() => { /* Swallow error, this is success path */ }
)
.then(() => { return extHost.$getCredentialProvider(''); })
.then(
() => { done('Provider was returned from \'\''); },
() => { done(); }
() => { done('Provider was returned from \'\''); },
() => { done(); }
);
});
});

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
@@ -24,7 +23,7 @@ suite('ExtHostNotebook Tests', () => {
let notebookUri: URI;
let notebookProviderMock: TypeMoq.Mock<NotebookProviderStub>;
setup(() => {
mockProxy = TypeMoq.Mock.ofInstance(<MainThreadNotebookShape> {
mockProxy = TypeMoq.Mock.ofInstance(<MainThreadNotebookShape>{
$registerNotebookProvider: (providerId, handle) => undefined,
$unregisterNotebookProvider: (handle) => undefined,
dispose: () => undefined
@@ -106,9 +105,9 @@ suite('ExtHostNotebook Tests', () => {
extHostNotebook.registerNotebookProvider(notebookProviderMock.object);
mockProxy.verify(p =>
p.$registerNotebookProvider(TypeMoq.It.isValue(notebookProviderMock.object.providerId),
TypeMoq.It.isAnyNumber()), TypeMoq.Times.once());
// It shouldn't unregister until requested
mockProxy.verify(p => p.$unregisterNotebookProvider(TypeMoq.It.isValue(savedHandle)), TypeMoq.Times.never());
TypeMoq.It.isAnyNumber()), TypeMoq.Times.once());
// It shouldn't unregister until requested
mockProxy.verify(p => p.$unregisterNotebookProvider(TypeMoq.It.isValue(savedHandle)), TypeMoq.Times.never());
});
@@ -122,7 +121,7 @@ suite('ExtHostNotebook Tests', () => {
class NotebookProviderStub implements azdata.nb.NotebookProvider {
providerId: string = 'TestProvider';
standardKernels: azdata.nb.IStandardKernel[] = [{name: 'fakeKernel', displayName: 'fakeKernel', connectionProviderIds: ['MSSQL']}];
standardKernels: azdata.nb.IStandardKernel[] = [{ name: 'fakeKernel', displayName: 'fakeKernel', connectionProviderIds: ['MSSQL'] }];
getNotebookManager(notebookUri: vscode.Uri): Thenable<azdata.nb.NotebookManager> {
throw new Error('Method not implemented.');