Add more folders to strict compile (#8954)

* add more folders to strictire compile, add more strict compile options

* update ci

* remove unnecessary assertion
This commit is contained in:
Anthony Dresser
2020-01-27 16:26:49 -08:00
committed by GitHub
parent fefe1454de
commit 64929de09d
81 changed files with 630 additions and 644 deletions

View File

@@ -126,11 +126,11 @@ suite('ConnectionConfig', () => {
options: [
{
name: 'serverName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.serverName,
@@ -138,11 +138,11 @@ suite('ConnectionConfig', () => {
},
{
name: 'databaseName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.databaseName,
@@ -150,11 +150,11 @@ suite('ConnectionConfig', () => {
},
{
name: 'userName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.userName,
@@ -162,11 +162,11 @@ suite('ConnectionConfig', () => {
},
{
name: 'authenticationType',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.authType,
@@ -174,11 +174,11 @@ suite('ConnectionConfig', () => {
},
{
name: 'password',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.password,
@@ -218,7 +218,7 @@ suite('ConnectionConfig', () => {
}
// weird way to verify that each group appears the same number of times in each array
let result = groupsAreEqual(groups1.filter(a => a.parentId === group.id), groups2.filter(b => b.parentId === g2.id));
let result = groupsAreEqual(groups1.filter(a => a.parentId === group.id), groups2.filter(b => b.parentId === g2!.id));
if (!result) {
return false;
}
@@ -251,13 +251,13 @@ suite('ConnectionConfig', () => {
savePassword: true,
groupFullName: undefined,
groupId: undefined,
getOptionsKey: undefined,
matches: undefined,
getOptionsKey: undefined!,
matches: undefined!,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: undefined,
connectionName: undefined
id: undefined!,
connectionName: undefined!
};
let configurationService = new TestConfigurationService();
@@ -269,7 +269,7 @@ suite('ConnectionConfig', () => {
let savedConnectionProfile = await config.addConnection(connectionProfile);
assert.ok(!!savedConnectionProfile.id);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length + 1);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length + 1);
});
test('addConnection should not add the new profile to user settings if already exists', async () => {
@@ -283,13 +283,13 @@ suite('ConnectionConfig', () => {
groupId: existingConnection.groupId,
savePassword: true,
groupFullName: undefined,
getOptionsKey: undefined,
matches: undefined,
getOptionsKey: undefined!,
matches: undefined!,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: undefined,
connectionName: undefined
id: undefined!,
connectionName: undefined!
};
let configurationService = new TestConfigurationService();
@@ -303,7 +303,7 @@ suite('ConnectionConfig', () => {
let savedConnectionProfile = await config.addConnection(connectionProfile);
assert.equal(savedConnectionProfile.id, existingConnection.id);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length);
});
test('addConnection should add the new group to user settings if does not exist', async () => {
@@ -316,13 +316,13 @@ suite('ConnectionConfig', () => {
savePassword: true,
groupFullName: 'g2/g2-2',
groupId: undefined,
getOptionsKey: undefined,
matches: undefined,
getOptionsKey: undefined!,
matches: undefined!,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: undefined,
connectionName: undefined
id: undefined!,
connectionName: undefined!
};
let configurationService = new TestConfigurationService();
@@ -333,8 +333,8 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
await config.addConnection(connectionProfile);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length + 1);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connectionGroups').userValue.length, testGroups.length + 1);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length + 1);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connectionGroups').userValue!.length, testGroups.length + 1);
});
test('getConnections should return connections from user and workspace settings given getWorkspaceConnections set to true', () => {
@@ -363,7 +363,7 @@ suite('ConnectionConfig', () => {
return c;
});
let userConnections = deepClone(testConnections).map(c => {
c.id = undefined;
c.id = undefined!;
return c;
});
let configurationService = new TestConfigurationService();
@@ -381,13 +381,13 @@ suite('ConnectionConfig', () => {
} else {
let workspaceConnection = find(workspaceConnections, u => u.options['serverName'] === connection.serverName);
assert.notEqual(connection.id, connection.getOptionsKey());
assert.equal(workspaceConnection.id, connection.id);
assert.equal(workspaceConnection!.id, connection.id);
}
});
});
test('saveGroup should save the new groups to tree and return the id of the last group name', () => {
let config = new ConnectionConfig(undefined, undefined);
let config = new ConnectionConfig(undefined!, undefined!);
let groups: IConnectionProfileGroup[] = deepClone(testGroups);
let newGroups: string = 'ROOT/g1/g1-1/new-group/new-group2';
let color: string = 'red';
@@ -396,11 +396,11 @@ suite('ConnectionConfig', () => {
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length + 2, 'The result groups length is invalid');
let newGroup = find(result.groups, g => g.name === 'new-group2');
assert.equal(result.newGroupId, newGroup.id, 'The groups id is invalid');
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
});
test('saveGroup should only add the groups that are not in the tree', () => {
let config = new ConnectionConfig(undefined, undefined);
let config = new ConnectionConfig(undefined!, undefined!);
let groups: IConnectionProfileGroup[] = deepClone(testGroups);
let newGroups: string = 'ROOT/g2/g2-5';
let color: string = 'red';
@@ -409,11 +409,11 @@ suite('ConnectionConfig', () => {
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length + 1, 'The result groups length is invalid');
let newGroup = find(result.groups, g => g.name === 'g2-5');
assert.equal(result.newGroupId, newGroup.id, 'The groups id is invalid');
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
});
test('saveGroup should not add any new group if tree already has all the groups in the full path', () => {
let config = new ConnectionConfig(undefined, undefined);
let config = new ConnectionConfig(undefined!, undefined!);
let groups: IConnectionProfileGroup[] = deepClone(testGroups);
let newGroups: string = 'ROOT/g2/g2-1';
let color: string = 'red';
@@ -422,7 +422,7 @@ suite('ConnectionConfig', () => {
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length, 'The result groups length is invalid');
let newGroup = find(result.groups, g => g.name === 'g2-1');
assert.equal(result.newGroupId, newGroup.id, 'The groups id is invalid');
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
});
test('deleteConnection should remove the connection from config', async () => {
@@ -435,13 +435,13 @@ suite('ConnectionConfig', () => {
savePassword: true,
groupFullName: 'g3',
groupId: 'g3',
getOptionsKey: undefined,
matches: undefined,
getOptionsKey: undefined!,
matches: undefined!,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: undefined,
connectionName: undefined
id: undefined!,
connectionName: undefined!
};
let configurationService = new TestConfigurationService();
configurationService.updateValue('datasource.connections', deepClone(testConnections), ConfigurationTarget.USER);
@@ -452,7 +452,7 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
await config.deleteConnection(connectionProfile);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length - 1);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length - 1);
});
test('deleteConnectionGroup should remove the children connections and subgroups from config', async () => {
@@ -465,13 +465,13 @@ suite('ConnectionConfig', () => {
savePassword: true,
groupFullName: 'g3',
groupId: 'g3',
getOptionsKey: undefined,
matches: undefined,
getOptionsKey: undefined!,
matches: undefined!,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: undefined,
connectionName: undefined
id: undefined!,
connectionName: undefined!
};
let configurationService = new TestConfigurationService();
configurationService.updateValue('datasource.connections', deepClone(testConnections), ConfigurationTarget.USER);
@@ -488,8 +488,8 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
await config.deleteGroup(connectionProfileGroup);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length - 1);
assert.equal(configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue.length, testGroups.length - 2);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length - 1);
assert.equal(configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!.length, testGroups.length - 2);
});
test('deleteConnection should not throw error for connection not in config', async () => {
@@ -502,13 +502,13 @@ suite('ConnectionConfig', () => {
savePassword: true,
groupFullName: 'g3',
groupId: 'newid',
getOptionsKey: undefined,
matches: undefined,
getOptionsKey: undefined!,
matches: undefined!,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: undefined,
connectionName: undefined
id: undefined!,
connectionName: undefined!
};
let configurationService = new TestConfigurationService();
configurationService.updateValue('datasource.connections', deepClone(testConnections), ConfigurationTarget.USER);
@@ -517,7 +517,7 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
await config.deleteConnection(connectionProfile);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length);
});
test('renameGroup should change group name', async () => {
@@ -528,12 +528,12 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
await config.editGroup(connectionProfileGroup);
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue;
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
assert.equal(editedGroups.length, testGroups.length);
let editedGroup = find(editedGroups, group => group.id === 'g2');
assert.ok(!!editedGroup);
assert.equal(editedGroup.name, 'g-renamed');
assert.equal(editedGroup!.name, 'g-renamed');
});
test('edit group should throw if there is a confliction', async () => {
@@ -547,10 +547,10 @@ suite('ConnectionConfig', () => {
await config.editGroup(sameNameGroup);
assert.fail();
} catch (e) {
let groups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue;
let groups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
let originalGroup = find(groups, g => g.id === 'g2');
assert.ok(!!originalGroup);
assert.equal(originalGroup.name, 'g2');
assert.equal(originalGroup!.name, 'g2');
}
});
@@ -563,12 +563,12 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
await config.changeGroupIdForConnectionGroup(sourceProfileGroup, targetProfileGroup);
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue;
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
assert.equal(editedGroups.length, testGroups.length);
let editedGroup = find(editedGroups, group => group.id === 'g2');
assert.ok(!!editedGroup);
assert.equal(editedGroup.parentId, 'g3');
assert.equal(editedGroup!.parentId, 'g3');
});
@@ -583,12 +583,12 @@ suite('ConnectionConfig', () => {
groupFullName: 'g3',
groupId: 'g3',
getOptionsKey: () => { return 'connectionId'; },
matches: undefined,
matches: undefined!,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: 'server3-2',
connectionName: undefined
connectionName: undefined!
};
let existingProfile = ConnectionProfile.convertToProfileStore(capabilitiesService.object, {
serverName: 'server3',
@@ -600,15 +600,15 @@ suite('ConnectionConfig', () => {
groupFullName: 'test',
groupId: 'test',
getOptionsKey: () => { return 'connectionId'; },
matches: undefined,
matches: undefined!,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: 'server3',
connectionName: undefined
connectionName: undefined!
});
let _testConnections = deepClone(testConnections).concat([existingProfile, changingProfile]);
let _testConnections = [...deepClone(testConnections), existingProfile, changingProfile];
let configurationService = new TestConfigurationService();
configurationService.updateValue('datasource.connections', _testConnections, ConfigurationTarget.USER);
@@ -620,12 +620,12 @@ suite('ConnectionConfig', () => {
await config.changeGroupIdForConnection(connectionProfile, 'test');
assert.fail();
} catch (e) {
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue;
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!;
// two
assert.equal(editedConnections.length, _testConnections.length);
let editedConnection = find(editedConnections, con => con.id === 'server3-2');
assert.ok(!!editedConnection);
assert.equal(editedConnection.groupId, 'g3');
assert.equal(editedConnection!.groupId, 'g3');
}
});
@@ -640,12 +640,12 @@ suite('ConnectionConfig', () => {
groupFullName: 'g3',
groupId: 'g3',
getOptionsKey: () => { return 'connectionId'; },
matches: undefined,
matches: undefined!,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: 'server3',
connectionName: undefined
connectionName: undefined!
};
let configurationService = new TestConfigurationService();
@@ -657,11 +657,11 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
await config.changeGroupIdForConnection(connectionProfile, newId);
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue;
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!;
assert.equal(editedConnections.length, testConnections.length);
let editedConnection = find(editedConnections, con => con.id === 'server3');
assert.ok(!!editedConnection);
assert.equal(editedConnection.groupId, 'newid');
assert.equal(editedConnection!.groupId, 'newid');
});
test('addConnection should not move the connection when editing', async () => {
@@ -691,7 +691,7 @@ suite('ConnectionConfig', () => {
test('addgroup works', async () => {
let newGroup: IConnectionProfileGroup = {
id: undefined,
id: undefined!,
parentId: undefined,
name: 'new group',
color: 'red',
@@ -704,14 +704,14 @@ suite('ConnectionConfig', () => {
await config.addGroup(newGroup);
let editGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue;
let editGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
assert.equal(editGroups.length, testGroups.length + 1);
});
test('addGroup rejects if group name already exists', async () => {
let existingGroupName: IConnectionProfileGroup = {
id: undefined,
id: undefined!,
parentId: undefined,
name: 'g2',
color: 'red',
@@ -725,7 +725,7 @@ suite('ConnectionConfig', () => {
await config.addGroup(existingGroupName);
assert.fail();
} catch (e) {
let editGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue;
let editGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
assert.equal(editGroups.length, testGroups.length);
}

View File

@@ -27,12 +27,12 @@ suite('SQL ConnectionProfileInfo tests', () => {
savePassword: true,
groupFullName: 'g2/g2-2',
groupId: 'group id',
getOptionsKey: undefined,
matches: undefined,
getOptionsKey: undefined!,
matches: undefined!,
providerName: mssqlProviderName,
options: {},
saveProfile: true,
id: undefined
id: undefined!
};
let storedProfile: IConnectionProfileStore = {
@@ -54,11 +54,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
let connectionProvider: azdata.ConnectionOption[] = [
{
name: 'connectionName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.connectionName,
@@ -66,11 +66,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
},
{
name: 'serverName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.serverName,
@@ -78,11 +78,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
},
{
name: 'databaseName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.databaseName,
@@ -90,11 +90,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
},
{
name: 'userName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.userName,
@@ -102,11 +102,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
},
{
name: 'authenticationType',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.authType,
@@ -114,11 +114,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
},
{
name: 'password',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.password,
@@ -135,7 +135,7 @@ suite('SQL ConnectionProfileInfo tests', () => {
});
test('set properties should set the values correctly', () => {
let conn = new ConnectionProfile(capabilitiesService, undefined);
let conn = new ConnectionProfile(capabilitiesService, undefined!);
assert.equal(conn.serverName, undefined);
conn.connectionName = connectionProfile.connectionName;
conn.serverName = connectionProfile.serverName;

View File

@@ -43,7 +43,7 @@ suite('SQL ConnectionProfileGroup tests', () => {
});
test('getGroupFullNameParts should return a list With ROOT in it given null', () => {
let groupFullName: string = undefined;
let groupFullName: string = undefined!;
let expected: string[] = [ConnectionProfileGroup.RootGroupName];
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
assert.deepEqual(actual, expected);
@@ -99,7 +99,7 @@ suite('SQL ConnectionProfileGroup tests', () => {
});
test('isRoot should return true given null', () => {
let name: string = undefined;
let name: string = undefined!;
let expected: boolean = true;
let actual = ConnectionProfileGroup.isRoot(name);
assert.deepEqual(actual, expected);

View File

@@ -31,12 +31,12 @@ suite('ConnectionStore', () => {
savePassword: true,
groupId: '',
groupFullName: '',
getOptionsKey: undefined,
getOptionsKey: undefined!,
matches: () => false,
providerName: mssqlProviderName,
options: {},
saveProfile: true,
id: undefined
id: undefined!
});
let capabilitiesService: TestCapabilitiesService;
let maxRecent = 5;
@@ -51,11 +51,11 @@ suite('ConnectionStore', () => {
let connectionProvider: azdata.ConnectionOption[] = [
{
name: 'connectionName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.connectionName,
@@ -63,11 +63,11 @@ suite('ConnectionStore', () => {
},
{
name: 'serverName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.serverName,
@@ -75,11 +75,11 @@ suite('ConnectionStore', () => {
},
{
name: 'databaseName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.databaseName,
@@ -87,11 +87,11 @@ suite('ConnectionStore', () => {
},
{
name: 'userName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.userName,
@@ -99,11 +99,11 @@ suite('ConnectionStore', () => {
},
{
name: 'authenticationType',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.authType,
@@ -111,11 +111,11 @@ suite('ConnectionStore', () => {
},
{
name: 'password',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.password,
@@ -232,8 +232,8 @@ suite('ConnectionStore', () => {
let current = connectionStore.getRecentlyUsedConnections();
// Then verify that since its password based we save the password
assert.equal(credentialsService.credentials.size, 1);
assert.strictEqual(recentCredential.password, defaultNamedProfile.password);
assert.ok(recentCredential.credentialId.indexOf('Profile') > -1, 'Expect credential to be marked as an Profile cred');
assert.strictEqual(recentCredential!.password, defaultNamedProfile.password);
assert.ok(recentCredential!.credentialId.indexOf('Profile') > -1, 'Expect credential to be marked as an Profile cred');
assert.ok(!current[0].password);
// When add integrated auth connection
const integratedCredConnectionProfile = new ConnectionProfile(capabilitiesService, integratedCred);
@@ -376,11 +376,11 @@ suite('ConnectionStore', () => {
credentialsService, capabilitiesService);
// If I look up the parent group using its ID, then I get back the correct group
let actualGroup = connectionStore.getGroupFromId(parentGroupId);
let actualGroup = connectionStore.getGroupFromId(parentGroupId)!;
assert.equal(actualGroup.id, parentGroupId, 'Did not get the parent group when looking it up with its ID');
// If I look up the child group using its ID, then I get back the correct group
actualGroup = connectionStore.getGroupFromId(childGroupId);
actualGroup = connectionStore.getGroupFromId(childGroupId)!;
assert.equal(actualGroup.id, childGroupId, 'Did not get the child group when looking it up with its ID');
});

View File

@@ -26,12 +26,12 @@ suite('SQL ProviderConnectionInfo tests', () => {
savePassword: true,
groupFullName: 'g2/g2-2',
groupId: undefined,
getOptionsKey: undefined,
matches: undefined,
getOptionsKey: undefined!,
matches: undefined!,
providerName: mssqlProviderName,
options: undefined,
options: undefined!,
saveProfile: true,
id: undefined
id: undefined!
};
setup(() => {
@@ -39,11 +39,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
let connectionProvider: azdata.ConnectionOption[] = [
{
name: 'connectionName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.connectionName,
@@ -51,11 +51,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
},
{
name: 'serverName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.serverName,
@@ -63,11 +63,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
},
{
name: 'databaseName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.databaseName,
@@ -75,11 +75,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
},
{
name: 'userName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.userName,
@@ -87,11 +87,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
},
{
name: 'authenticationType',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.authType,
@@ -99,11 +99,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
},
{
name: 'password',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: true,
isRequired: true,
specialValueType: ConnectionOptionSpecialType.password,
@@ -111,14 +111,14 @@ suite('SQL ProviderConnectionInfo tests', () => {
},
{
name: 'encrypt',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
displayName: undefined!,
description: undefined!,
groupName: undefined!,
categoryValues: undefined!,
defaultValue: undefined!,
isIdentity: false,
isRequired: false,
specialValueType: undefined,
specialValueType: undefined!,
valueType: ServiceOptionType.string
}
];
@@ -133,7 +133,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
});
test('constructor should accept undefined parameters', () => {
let conn = new ProviderConnectionInfo(undefined, undefined);
let conn = new ProviderConnectionInfo(undefined!, undefined!);
assert.equal(conn.serverName, undefined);
});
@@ -201,7 +201,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
});
test('constructor should initialize the options given a valid model with options', () => {
let options = {};
let options: { [key: string]: string } = {};
options['encrypt'] = 'test value';
let conn2 = assign({}, connectionProfile, { options: options });
let conn = new ProviderConnectionInfo(capabilitiesService, conn2);
@@ -247,7 +247,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
});
test('getProviderFromOptionsKey should return empty string give null', () => {
let optionsKey = undefined;
let optionsKey = undefined!;
let expectedProviderId: string = '';
let actual = ProviderConnectionInfo.getProviderFromOptionsKey(optionsKey);

View File

@@ -8,7 +8,7 @@ import { getConfigurationKeys, IConfigurationOverrides, IConfigurationService, g
export class TestConfigurationService implements IConfigurationService {
public _serviceBrand: undefined;
private configuration = {
private configuration: { user: { [key: string]: any }; workspace: { [key: string]: any } } = {
user: {},
workspace: {}
};
@@ -22,7 +22,7 @@ export class TestConfigurationService implements IConfigurationService {
}
public updateValue(key: string, value: any, target?: any): Promise<void> {
let _target = (target as ConfigurationTarget) === ConfigurationTarget.USER ? 'user' : 'workspace';
let _target: 'user' | 'workspace' = (target as ConfigurationTarget) === ConfigurationTarget.USER ? 'user' : 'workspace';
let keyArray = key.split('.');
let targetObject = this.configuration[_target];
for (let i = 0; i < keyArray.length; i++) {

View File

@@ -16,11 +16,16 @@ import { ConnectionProviderProperties } from 'sql/platform/capabilities/common/c
// Test stubs for commonly used objects
export class TestConnectionManagementService implements IConnectionManagementService {
disconnect(connection: IConnectionProfile): Promise<void>;
disconnect(ownerUri: string): Promise<void>;
disconnect(ownerUri: any) {
return Promise.resolve();
}
_serviceBrand: undefined;
onAddConnectionProfile = undefined;
onDeleteConnectionProfile = undefined;
onConnectionChanged = undefined;
onLanguageFlavorChanged = undefined;
onAddConnectionProfile = undefined!;
onDeleteConnectionProfile = undefined!;
onConnectionChanged = undefined!;
onLanguageFlavorChanged = undefined!;
public get onConnect(): Event<any> {
return Event.None;
@@ -43,15 +48,15 @@ export class TestConnectionManagementService implements IConnectionManagementSer
}
showConnectionDialog(params?: INewConnectionParams, options?: IConnectionCompletionOptions, model?: IConnectionProfile, connectionResult?: IConnectionResult): Promise<void> {
return undefined;
return undefined!;
}
showCreateServerGroupDialog(): Promise<void> {
return undefined;
return undefined!;
}
showEditServerGroupDialog(group: ConnectionProfileGroup): Promise<void> {
return undefined;
return undefined!;
}
onConnectionComplete(handle: number, connectionInfoSummary: azdata.ConnectionInfoSummary): void {
@@ -67,7 +72,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
}
getCurrentConnectionSummary(): azdata.ConnectionSummary {
return undefined;
return undefined!;
}
getConnectionGroups(providers?: string[]): ConnectionProfileGroup[] {
@@ -79,7 +84,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
}
saveProfileGroup(profile: IConnectionProfileGroup): Promise<string> {
return undefined;
return undefined!;
}
getRecentConnections(providers?: string[]): ConnectionProfile[] {
@@ -123,15 +128,15 @@ export class TestConnectionManagementService implements IConnectionManagementSer
}
getConnectionUri(connectionProfile: ConnectionProfile): string {
return undefined;
return undefined!;
}
getFormattedUri(uri: string, connectionProfile: ConnectionProfile): string {
return undefined;
return undefined!;
}
getConnectionUriFromId(connectionId: string): string {
return undefined;
return undefined!;
}
isConnected(fileUri: string, connectionProfile?: ConnectionProfile): boolean {
@@ -151,12 +156,12 @@ export class TestConnectionManagementService implements IConnectionManagementSer
}
findExistingConnection(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection'): ConnectionProfile {
return undefined;
return undefined!;
}
connect(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
return new Promise<IConnectionResult>((resolve, reject) => {
resolve({ connected: true, errorMessage: undefined, errorCode: undefined, callStack: undefined });
resolve({ connected: true, errorMessage: undefined!, errorCode: undefined!, callStack: undefined! });
});
}
@@ -168,20 +173,12 @@ export class TestConnectionManagementService implements IConnectionManagementSer
return new Promise<boolean>(() => true);
}
disconnect(connection: IConnectionProfile);
disconnect(uri: string);
disconnect(input: any): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
resolve(true);
});
}
getConnectionProfile(fileUri: string): IConnectionProfile {
return undefined;
return undefined!;
}
getConnectionInfo(fileUri: string): ConnectionManagementInfo {
return undefined;
return undefined!;
}
addSavedPassword(connectionProfile: IConnectionProfile): Promise<IConnectionProfile> {
@@ -189,15 +186,15 @@ export class TestConnectionManagementService implements IConnectionManagementSer
}
public listDatabases(connectionUri: string): Thenable<azdata.ListDatabasesResult> {
return Promise.resolve(undefined);
return Promise.resolve(undefined!);
}
cancelConnection(connection: IConnectionProfile): Thenable<boolean> {
return undefined;
return undefined!;
}
cancelEditorConnection(owner: IConnectableInput): Thenable<boolean> {
return undefined;
return undefined!;
}
showDashboard(connection: ConnectionProfile): Promise<boolean> {
@@ -220,7 +217,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
}
getProviderIdFromUri(ownerUri: string): string {
return undefined;
return undefined!;
}
hasRegisteredServers(): boolean {
@@ -228,7 +225,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
}
getCapabilities(providerName: string): azdata.DataProtocolServerCapabilities {
return undefined;
return undefined!;
}
canChangeConnectionConfig(profile: ConnectionProfile, newGroupID: string): boolean {
@@ -243,55 +240,55 @@ export class TestConnectionManagementService implements IConnectionManagementSer
}
connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection', saveConnection: boolean = false): Promise<string> {
return undefined;
return undefined!;
}
rebuildIntelliSenseCache(uri: string): Thenable<void> {
return undefined;
return undefined!;
}
getTabColorForUri(uri: string): string {
return undefined;
return undefined!;
}
removeConnectionProfileCredentials(profile: IConnectionProfile): IConnectionProfile {
return undefined;
return undefined!;
}
getActiveConnectionCredentials(profileId: string): { [name: string]: string } {
return undefined;
return undefined!;
}
getServerInfo(profileId: string): azdata.ServerInfo {
return undefined;
return undefined!;
}
getConnectionString(connectionId: string): Thenable<string> {
return undefined;
return undefined!;
}
buildConnectionInfo(connectionString: string, provider?: string): Thenable<azdata.ConnectionInfo> {
return undefined;
return undefined!;
}
providerRegistered(providerId: string): boolean {
return undefined;
return undefined!;
}
getConnectionProfileById(profileId: string): IConnectionProfile {
return undefined;
return undefined!;
}
getProviderProperties(providerName: string): ConnectionProviderProperties {
return undefined;
return undefined!;
}
getConnectionIconId(connectionId: string): string {
return undefined;
return undefined!;
}
getDefaultProviderId(): string {
return undefined;
return undefined!;
}
getConnections(activeConnectionsOnly?: boolean): ConnectionProfile[] {
@@ -299,6 +296,6 @@ export class TestConnectionManagementService implements IConnectionManagementSer
}
getConnection(uri: string): ConnectionProfile {
return undefined;
return undefined!;
}
}

View File

@@ -10,31 +10,31 @@ export class TestConnectionProvider implements azdata.ConnectionProvider {
public readonly providerId = mssqlProviderName;
connect(connectionUri: string, connectionInfo: azdata.ConnectionInfo): Thenable<boolean> {
return undefined;
return Promise.resolve(true);
}
disconnect(connectionUri: string): Thenable<boolean> {
return undefined;
return Promise.resolve(true);
}
cancelConnect(connectionUri: string): Thenable<boolean> {
return undefined;
return Promise.resolve(true);
}
listDatabases(connectionUri: string): Thenable<azdata.ListDatabasesResult> {
return undefined;
return Promise.resolve({ databaseNames: [] });
}
changeDatabase(connectionUri: string, newDatabase: string): Thenable<boolean> {
return undefined;
return Promise.resolve(true);
}
getConnectionString(connectionUri: string): Thenable<string> {
return undefined;
return Promise.resolve('');
}
rebuildIntelliSenseCache(connectionUri: string): Thenable<void> {
return undefined;
return Promise.resolve();
}
registerOnConnectionComplete(handler: (connSummary: azdata.ConnectionInfoSummary) => any) {
@@ -48,4 +48,4 @@ export class TestConnectionProvider implements azdata.ConnectionProvider {
registerOnConnectionChanged(handler: (changedConnInfo: azdata.ChangedConnectionInfo) => any) {
return undefined;
}
}
}