Replace deprecated assert functions in test files. (#16945)

This commit is contained in:
Cory Rivera
2021-08-31 09:04:17 -07:00
committed by GitHub
parent de3ff30398
commit 0082031f97
79 changed files with 1960 additions and 1965 deletions

View File

@@ -61,7 +61,7 @@ suite('Account picker view model tests', () => {
// Then:
// ... The event for the view models should be properly initialized
assert.notEqual(vm.updateAccountListEvent, undefined);
assert.notStrictEqual(vm.updateAccountListEvent, undefined);
// ... The event should properly fire
let argUpdateAccounts: UpdateAccountListEventParams = { providerId: providers[0].id, accountList: accounts };
@@ -89,8 +89,8 @@ suite('Account picker view model tests', () => {
// ... The results that were returned should be an array of account
assert.ok(Array.isArray(results));
assert.equal(results.length, 2);
assert.equal(results, accounts);
assert.strictEqual(results.length, 2);
assert.strictEqual(results, accounts);
});
});
@@ -112,7 +112,7 @@ suite('Account picker view model tests', () => {
// ... The results should be an empty array
assert.ok(Array.isArray(result));
assert.equal(result.length, 0);
assert.strictEqual(result.length, 0);
});
});
});

View File

@@ -27,7 +27,7 @@ suite('Account Store Tests', () => {
// ... The memento should have been initialized and account added
assert.ok(Array.isArray(memento[AccountStore.MEMENTO_KEY]));
assert.equal(memento[AccountStore.MEMENTO_KEY].length, 1);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY].length, 1);
assertAccountEqual(memento[AccountStore.MEMENTO_KEY][0], account1);
});
});
@@ -49,7 +49,7 @@ suite('Account Store Tests', () => {
// ... The memento should have the account added
assert.ok(Array.isArray(memento[AccountStore.MEMENTO_KEY]));
assert.equal(memento[AccountStore.MEMENTO_KEY].length, 1);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY].length, 1);
assertAccountEqual(memento[AccountStore.MEMENTO_KEY][0], account1);
});
});
@@ -75,7 +75,7 @@ suite('Account Store Tests', () => {
// ... The memento should have been initialized and account updated
assert.ok(Array.isArray(memento[AccountStore.MEMENTO_KEY]));
assert.equal(memento[AccountStore.MEMENTO_KEY].length, 2);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY].length, 2);
assertAccountEqual(memento[AccountStore.MEMENTO_KEY][0], account1);
assertAccountEqual(memento[AccountStore.MEMENTO_KEY][1], param);
});
@@ -92,10 +92,10 @@ suite('Account Store Tests', () => {
// Then:
// ... I should get back an empty array
assert.ok(Array.isArray(result));
assert.equal(result.length, 0);
assert.strictEqual(result.length, 0);
// ... Memento should not have been written
assert.equal(Object.keys(memento).length, 0);
assert.strictEqual(Object.keys(memento).length, 0);
});
});
@@ -110,7 +110,7 @@ suite('Account Store Tests', () => {
.then(result => {
// Then: I should get back an empty array
assert.ok(Array.isArray(result));
assert.equal(result.length, 0);
assert.strictEqual(result.length, 0);
});
});
@@ -124,7 +124,7 @@ suite('Account Store Tests', () => {
.then(result => {
// Then: I should get back an empty array
assert.ok(Array.isArray(result));
assert.equal(result.length, 0);
assert.strictEqual(result.length, 0);
});
});
@@ -138,7 +138,7 @@ suite('Account Store Tests', () => {
.then(result => {
// Then: I should get the accounts
assert.ok(Array.isArray(result));
assert.equal(result.length, 2);
assert.strictEqual(result.length, 2);
assertAccountEqual(result[0], memento[AccountStore.MEMENTO_KEY][0]);
assertAccountEqual(result[1], memento[AccountStore.MEMENTO_KEY][1]);
});
@@ -155,10 +155,10 @@ suite('Account Store Tests', () => {
// Then:
// ... I should get back an empty array
assert.ok(Array.isArray(result));
assert.equal(result.length, 0);
assert.strictEqual(result.length, 0);
// ... Memento should not have been written
assert.equal(Object.keys(memento).length, 0);
assert.strictEqual(Object.keys(memento).length, 0);
});
});
@@ -173,7 +173,7 @@ suite('Account Store Tests', () => {
.then(result => {
// Then: I should get back an empty array
assert.ok(Array.isArray(result));
assert.equal(result.length, 0);
assert.strictEqual(result.length, 0);
});
});
@@ -187,7 +187,7 @@ suite('Account Store Tests', () => {
.then(result => {
// Then: I should get the accounts
assert.ok(Array.isArray(result));
assert.equal(result.length, 2);
assert.strictEqual(result.length, 2);
assertAccountEqual(result[0], memento[AccountStore.MEMENTO_KEY][0]);
assertAccountEqual(result[1], memento[AccountStore.MEMENTO_KEY][1]);
});
@@ -207,7 +207,7 @@ suite('Account Store Tests', () => {
// ... The memento should have been initialized
assert.ok(Array.isArray(memento[AccountStore.MEMENTO_KEY]));
assert.equal(memento[AccountStore.MEMENTO_KEY].length, 0);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY].length, 0);
});
});
@@ -226,7 +226,7 @@ suite('Account Store Tests', () => {
// ... The memento should still be empty
assert.ok(Array.isArray(memento[AccountStore.MEMENTO_KEY]));
assert.equal(memento[AccountStore.MEMENTO_KEY].length, 0);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY].length, 0);
});
});
@@ -244,7 +244,7 @@ suite('Account Store Tests', () => {
// ... The memento should have removed the first account
assert.ok(Array.isArray(memento[AccountStore.MEMENTO_KEY]));
assert.equal(memento[AccountStore.MEMENTO_KEY].length, 1);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY].length, 1);
assertAccountEqual(memento[AccountStore.MEMENTO_KEY][0], account2);
});
});
@@ -267,7 +267,7 @@ suite('Account Store Tests', () => {
// ... The memento should have been initialized
assert.ok(Array.isArray(memento[AccountStore.MEMENTO_KEY]));
assert.equal(memento[AccountStore.MEMENTO_KEY].length, 0);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY].length, 0);
// ... The callback shouldn't have been called
updateCallback.assertNotFired();
@@ -292,7 +292,7 @@ suite('Account Store Tests', () => {
// ... The memento should still be empty
assert.ok(Array.isArray(memento[AccountStore.MEMENTO_KEY]));
assert.equal(memento[AccountStore.MEMENTO_KEY].length, 0);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY].length, 0);
// ... The callback shouldn't have been called
updateCallback.assertNotFired();
@@ -319,10 +319,10 @@ suite('Account Store Tests', () => {
// ... The memento still contains two accounts
assert.ok(Array.isArray(memento[AccountStore.MEMENTO_KEY]));
assert.equal(memento[AccountStore.MEMENTO_KEY].length, 2);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY].length, 2);
// ... Account 1 should have been updated
assert.equal(memento[AccountStore.MEMENTO_KEY][0].displayInfo.displayName, newDisplayName);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY][0].displayInfo.displayName, newDisplayName);
// ... Account 2 should have stayed the same
assertAccountEqual(memento[AccountStore.MEMENTO_KEY][1], account2);
@@ -334,11 +334,11 @@ suite('Account Store Tests', () => {
memento[AccountStore.MEMENTO_KEY].push(deprecatedAccount1, deprecatedAccount2);
let as = new AccountStore(memento, consoleLogService);
// We know that we have 4 accounts now
assert.equal(memento[AccountStore.MEMENTO_KEY].length, 4);
assert.strictEqual(memento[AccountStore.MEMENTO_KEY].length, 4);
return as.getAllAccounts().then(accounts => {
// After pruning we will have 2 accounts
assert.equal(accounts.length, 2);
assert.strictEqual(accounts.length, 2);
});
});
@@ -406,12 +406,12 @@ function getTestMemento() {
}
function assertAccountEqual(a: azdata.Account, b: azdata.Account) {
assert.equal(a.key.providerId, b.key.providerId);
assert.equal(a.key.accountId, b.key.accountId);
assert.strictEqual(a.key.providerId, b.key.providerId);
assert.strictEqual(a.key.accountId, b.key.accountId);
assert.equal(a.displayInfo.contextualDisplayName, b.displayInfo.contextualDisplayName);
assert.equal(a.displayInfo.accountType, b.displayInfo.accountType);
assert.equal(a.displayInfo.displayName, b.displayInfo.displayName);
assert.strictEqual(a.displayInfo.contextualDisplayName, b.displayInfo.contextualDisplayName);
assert.strictEqual(a.displayInfo.accountType, b.displayInfo.accountType);
assert.strictEqual(a.displayInfo.displayName, b.displayInfo.displayName);
assert.equal(a.isStale, b.isStale);
assert.strictEqual(a.isStale, b.isStale);
}

View File

@@ -68,9 +68,9 @@ suite('Account Management Dialog ViewModel Tests', () => {
// Then:
// ... All the events for the view models should be properly initialized
assert.notEqual(vm.addProviderEvent, undefined);
assert.notEqual(vm.removeProviderEvent, undefined);
assert.notEqual(vm.updateAccountListEvent, undefined);
assert.notStrictEqual(vm.addProviderEvent, undefined);
assert.notStrictEqual(vm.removeProviderEvent, undefined);
assert.notStrictEqual(vm.updateAccountListEvent, undefined);
// ... All the events should properly fire
let argAddProvider: AccountProviderAddedEventParams = { addedProvider: providers[0], initialAccounts: [] };
@@ -113,9 +113,9 @@ suite('Account Management Dialog ViewModel Tests', () => {
// ... The results that were returned should be an array of account provider added event params
assert.ok(Array.isArray(results));
assert.equal(results.length, 1);
assert.equal(results[0].addedProvider, providers[0]);
assert.equal(results[0].initialAccounts, accounts);
assert.strictEqual(results.length, 1);
assert.strictEqual(results[0].addedProvider, providers[0]);
assert.strictEqual(results[0].initialAccounts, accounts);
});
});
@@ -140,7 +140,7 @@ suite('Account Management Dialog ViewModel Tests', () => {
// ... The results that were returned should be an empty array
assert.ok(Array.isArray(results));
assert.equal(results.length, 0);
assert.strictEqual(results.length, 0);
});
});
@@ -165,9 +165,9 @@ suite('Account Management Dialog ViewModel Tests', () => {
// ... The results should include the provider
assert.ok(Array.isArray(result));
assert.equal(result.length, 1);
assert.equal(result[0].addedProvider, providers[0]);
assert.equal(result[0].initialAccounts, accounts);
assert.strictEqual(result.length, 1);
assert.strictEqual(result[0].addedProvider, providers[0]);
assert.strictEqual(result[0].initialAccounts, accounts);
});
});
});

View File

@@ -16,28 +16,28 @@ suite('Firewall rule view model tests', () => {
test('update default values to 250.222.155.198 should calculate the correct default subnet IP range', () => {
let IPAddress = '250.222.155.198';
viewModel.updateDefaultValues(IPAddress);
assert.equal(IPAddress, viewModel.defaultIPAddress);
assert.equal('250.222.155.0', viewModel.defaultFromSubnetIPRange);
assert.equal('250.222.155.255', viewModel.defaultToSubnetIPRange);
assert.strictEqual(IPAddress, viewModel.defaultIPAddress);
assert.strictEqual('250.222.155.0', viewModel.defaultFromSubnetIPRange);
assert.strictEqual('250.222.155.255', viewModel.defaultToSubnetIPRange);
});
test('update default values to 250.222.155.0 should calculate the correct default subnet IP range', () => {
let IPAddress = '250.222.155.2';
viewModel.updateDefaultValues(IPAddress);
assert.equal(IPAddress, viewModel.defaultIPAddress);
assert.equal('250.222.155.0', viewModel.defaultFromSubnetIPRange);
assert.equal('250.222.155.255', viewModel.defaultToSubnetIPRange);
assert.strictEqual(IPAddress, viewModel.defaultIPAddress);
assert.strictEqual('250.222.155.0', viewModel.defaultFromSubnetIPRange);
assert.strictEqual('250.222.155.255', viewModel.defaultToSubnetIPRange);
});
test('subnet IP range should return the correct values', () => {
let IPAddress = '250.222.155.198';
viewModel.updateDefaultValues(IPAddress);
assert.equal('250.222.155.0', viewModel.fromSubnetIPRange);
assert.equal('250.222.155.255', viewModel.toSubnetIPRange);
assert.strictEqual('250.222.155.0', viewModel.fromSubnetIPRange);
assert.strictEqual('250.222.155.255', viewModel.toSubnetIPRange);
viewModel.fromSubnetIPRange = '250.222.155.100';
viewModel.toSubnetIPRange = '250.222.155.220';
assert.equal('250.222.155.100', viewModel.fromSubnetIPRange);
assert.equal('250.222.155.220', viewModel.toSubnetIPRange);
assert.strictEqual('250.222.155.100', viewModel.fromSubnetIPRange);
assert.strictEqual('250.222.155.220', viewModel.toSubnetIPRange);
});
});

View File

@@ -235,7 +235,7 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
let allGroups = config.getAllGroups();
assert.equal(allGroups.length, testGroups.length, 'did not meet the expected length');
assert.strictEqual(allGroups.length, testGroups.length, 'did not meet the expected length');
assert.ok(groupsAreEqual(allGroups, testGroups), 'the groups returned did not match expectation');
});
@@ -248,7 +248,7 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
let allGroups = config.getAllGroups();
assert.equal(allGroups.length, testGroups.length, 'did not meet the expected length');
assert.strictEqual(allGroups.length, testGroups.length, 'did not meet the expected length');
assert.ok(groupsAreEqual(allGroups, testGroups), 'the groups returned did not match expectation');
assert.ok(allGroups.slice(1).every((item, i) => allGroups[i].name <= item.name), 'the groups are not sorted correctly');
});
@@ -262,7 +262,7 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
let allGroups = config.getAllGroups();
let expectedGroups = deepClone(testGroups).slice(0, 3).reverse().concat(deepClone(testGroups).slice(3, testGroups.length).reverse());
assert.equal(allGroups.length, expectedGroups.length, 'The result groups length is invalid');
assert.strictEqual(allGroups.length, expectedGroups.length, 'The result groups length is invalid');
assert.ok(allGroups.every((item, i) => item.id === allGroups[i].id));
});
@@ -294,7 +294,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.strictEqual(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 () => {
@@ -327,8 +327,8 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
let savedConnectionProfile = await config.addConnection(connectionProfile);
assert.equal(savedConnectionProfile.id, existingConnection.id);
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length);
assert.strictEqual(savedConnectionProfile.id, existingConnection.id);
assert.strictEqual(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length);
});
test('addConnection should add the new group to user settings if does not exist', async () => {
@@ -358,8 +358,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.strictEqual(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length + 1);
assert.strictEqual(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', () => {
@@ -369,7 +369,7 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
let allConnections = config.getConnections(true);
assert.equal(allConnections.length, testConnections.length);
assert.strictEqual(allConnections.length, testConnections.length);
});
test('getConnections should return connections from user settings given getWorkspaceConnections set to false', () => {
@@ -379,7 +379,7 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
let allConnections = config.getConnections(false);
assert.equal(allConnections.length, 2);
assert.strictEqual(allConnections.length, 2);
});
test('getConnections should return connections with a valid id', () => {
@@ -397,16 +397,16 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
let allConnections = config.getConnections(false);
assert.equal(allConnections.length, testConnections.length);
assert.strictEqual(allConnections.length, testConnections.length);
allConnections.forEach(connection => {
let userConnection = testConnections.find(u => u.options['serverName'] === connection.serverName);
if (userConnection !== undefined) {
assert.notEqual(connection.id, connection.getOptionsKey());
assert.notStrictEqual(connection.id, connection.getOptionsKey());
assert.ok(!!connection.id);
} else {
let workspaceConnection = workspaceConnections.find(u => u.options['serverName'] === connection.serverName);
assert.notEqual(connection.id, connection.getOptionsKey());
assert.equal(workspaceConnection!.id, connection.id);
assert.notStrictEqual(connection.id, connection.getOptionsKey());
assert.strictEqual(workspaceConnection!.id, connection.id);
}
});
});
@@ -419,7 +419,7 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
let allConnections = config.getConnections(true);
assert.equal(allConnections.length, testConnections.length, 'The result connections length is invalid');
assert.strictEqual(allConnections.length, testConnections.length, 'The result connections length is invalid');
assert.ok(allConnections.slice(1).every((item, i) => allConnections[i].title <= item.title), 'The connections are not sorted correctly');
});
@@ -431,7 +431,7 @@ suite('ConnectionConfig', () => {
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
let allConnections = config.getConnections(false);
let expectedConnections = deepClone(testConnections).reverse();
assert.equal(allConnections.length, expectedConnections.length, 'The result connections length is invalid');
assert.strictEqual(allConnections.length, expectedConnections.length, 'The result connections length is invalid');
assert.ok(allConnections.every((item, i) => item.id === expectedConnections[i].id));
});
@@ -443,9 +443,9 @@ suite('ConnectionConfig', () => {
let result: ISaveGroupResult = config.saveGroup(groups, newGroups, color, newGroups);
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length + 2, 'The result groups length is invalid');
assert.strictEqual(result.groups.length, testGroups.length + 2, 'The result groups length is invalid');
let newGroup = result.groups.find(g => g.name === 'new-group2');
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
assert.strictEqual(result.newGroupId, newGroup!.id, 'The groups id is invalid');
});
test('saveGroup should only add the groups that are not in the tree', () => {
@@ -456,9 +456,9 @@ suite('ConnectionConfig', () => {
let result: ISaveGroupResult = config.saveGroup(groups, newGroups, color, newGroups);
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length + 1, 'The result groups length is invalid');
assert.strictEqual(result.groups.length, testGroups.length + 1, 'The result groups length is invalid');
let newGroup = result.groups.find(g => g.name === 'g2-5');
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
assert.strictEqual(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', () => {
@@ -469,9 +469,9 @@ suite('ConnectionConfig', () => {
let result: ISaveGroupResult = config.saveGroup(groups, newGroups, color, newGroups);
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length, 'The result groups length is invalid');
assert.strictEqual(result.groups.length, testGroups.length, 'The result groups length is invalid');
let newGroup = result.groups.find(g => g.name === 'g2-1');
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
assert.strictEqual(result.newGroupId, newGroup!.id, 'The groups id is invalid');
});
test('deleteConnection should remove the connection from config', async () => {
@@ -501,7 +501,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.strictEqual(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length - 1);
});
test('deleteConnectionGroup should remove the children connections and subgroups from config', async () => {
@@ -537,8 +537,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.strictEqual(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length - 1);
assert.strictEqual(configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!.length, testGroups.length - 2);
});
test('deleteConnection should not throw error for connection not in config', async () => {
@@ -566,7 +566,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.strictEqual(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length);
});
test('renameGroup should change group name', async () => {
@@ -579,10 +579,10 @@ suite('ConnectionConfig', () => {
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
assert.equal(editedGroups.length, testGroups.length);
assert.strictEqual(editedGroups.length, testGroups.length);
let editedGroup = editedGroups.find(group => group.id === 'g2');
assert.ok(!!editedGroup);
assert.equal(editedGroup!.name, 'g-renamed');
assert.strictEqual(editedGroup!.name, 'g-renamed');
});
test('edit group should throw if there is a confliction', async () => {
@@ -599,7 +599,7 @@ suite('ConnectionConfig', () => {
let groups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
let originalGroup = groups.find(g => g.id === 'g2');
assert.ok(!!originalGroup);
assert.equal(originalGroup!.name, 'g2');
assert.strictEqual(originalGroup!.name, 'g2');
}
});
@@ -614,10 +614,10 @@ suite('ConnectionConfig', () => {
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
assert.equal(editedGroups.length, testGroups.length);
assert.strictEqual(editedGroups.length, testGroups.length);
let editedGroup = editedGroups.find(group => group.id === 'g2');
assert.ok(!!editedGroup);
assert.equal(editedGroup!.parentId, 'g3');
assert.strictEqual(editedGroup!.parentId, 'g3');
});
@@ -671,10 +671,10 @@ suite('ConnectionConfig', () => {
} catch (e) {
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!;
// two
assert.equal(editedConnections.length, _testConnections.length);
assert.strictEqual(editedConnections.length, _testConnections.length);
let editedConnection = editedConnections.find(con => con.id === 'server3-2');
assert.ok(!!editedConnection);
assert.equal(editedConnection!.groupId, 'g3');
assert.strictEqual(editedConnection!.groupId, 'g3');
}
});
@@ -707,10 +707,10 @@ suite('ConnectionConfig', () => {
await config.changeGroupIdForConnection(connectionProfile, newId);
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!;
assert.equal(editedConnections.length, testConnections.length);
assert.strictEqual(editedConnections.length, testConnections.length);
let editedConnection = editedConnections.find(con => con.id === 'server3');
assert.ok(!!editedConnection);
assert.equal(editedConnection!.groupId, 'newid');
assert.strictEqual(editedConnection!.groupId, 'newid');
});
test('addConnection should not move the connection when editing', async () => {
@@ -732,10 +732,10 @@ suite('ConnectionConfig', () => {
// Get the connection and verify that it is in the same place and has been updated
let newConnections = config.getConnections(false);
assert.equal(newConnections.length, oldLength);
assert.strictEqual(newConnections.length, oldLength);
let editedConnection = newConnections[connectionIndex];
assert.equal(editedConnection.getOptionsKey(), connectionToEdit.getOptionsKey());
assert.equal(editedConnection.options[optionKey], optionValue);
assert.strictEqual(editedConnection.getOptionsKey(), connectionToEdit.getOptionsKey());
assert.strictEqual(editedConnection.options[optionKey], optionValue);
});
test('addgroup works', async () => {
@@ -755,7 +755,7 @@ suite('ConnectionConfig', () => {
let editGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
assert.equal(editGroups.length, testGroups.length + 1);
assert.strictEqual(editGroups.length, testGroups.length + 1);
});
test('addGroup rejects if group name already exists', async () => {
@@ -776,7 +776,7 @@ suite('ConnectionConfig', () => {
} catch (e) {
let editGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
assert.equal(editGroups.length, testGroups.length);
assert.strictEqual(editGroups.length, testGroups.length);
}
});
});

View File

@@ -134,7 +134,7 @@ suite('SQL ConnectionProfileInfo tests', () => {
test('set properties should set the values correctly', () => {
let conn = new ConnectionProfile(capabilitiesService, undefined!);
assert.equal(conn.serverName, undefined);
assert.strictEqual(conn.serverName, undefined);
conn.connectionName = connectionProfile.connectionName!;
conn.serverName = connectionProfile.serverName;
conn.databaseName = connectionProfile.databaseName!;
@@ -144,75 +144,75 @@ suite('SQL ConnectionProfileInfo tests', () => {
conn.groupId = connectionProfile.groupId;
conn.groupFullName = connectionProfile.groupFullName;
conn.savePassword = connectionProfile.savePassword;
assert.equal(conn.connectionName, connectionProfile.connectionName);
assert.equal(conn.serverName, connectionProfile.serverName);
assert.equal(conn.databaseName, connectionProfile.databaseName);
assert.equal(conn.authenticationType, connectionProfile.authenticationType);
assert.equal(conn.password, connectionProfile.password);
assert.equal(conn.userName, connectionProfile.userName);
assert.equal(conn.groupId, connectionProfile.groupId);
assert.equal(conn.groupFullName, connectionProfile.groupFullName);
assert.equal(conn.savePassword, connectionProfile.savePassword);
assert.strictEqual(conn.connectionName, connectionProfile.connectionName);
assert.strictEqual(conn.serverName, connectionProfile.serverName);
assert.strictEqual(conn.databaseName, connectionProfile.databaseName);
assert.strictEqual(conn.authenticationType, connectionProfile.authenticationType);
assert.strictEqual(conn.password, connectionProfile.password);
assert.strictEqual(conn.userName, connectionProfile.userName);
assert.strictEqual(conn.groupId, connectionProfile.groupId);
assert.strictEqual(conn.groupFullName, connectionProfile.groupFullName);
assert.strictEqual(conn.savePassword, connectionProfile.savePassword);
});
test('constructor should initialize the options given a valid model', () => {
let conn = new ConnectionProfile(capabilitiesService, connectionProfile);
assert.equal(conn.connectionName, connectionProfile.connectionName);
assert.equal(conn.serverName, connectionProfile.serverName);
assert.equal(conn.databaseName, connectionProfile.databaseName);
assert.equal(conn.authenticationType, connectionProfile.authenticationType);
assert.equal(conn.password, connectionProfile.password);
assert.equal(conn.userName, connectionProfile.userName);
assert.equal(conn.groupId, connectionProfile.groupId);
assert.equal(conn.groupFullName, connectionProfile.groupFullName);
assert.equal(conn.savePassword, connectionProfile.savePassword);
assert.strictEqual(conn.connectionName, connectionProfile.connectionName);
assert.strictEqual(conn.serverName, connectionProfile.serverName);
assert.strictEqual(conn.databaseName, connectionProfile.databaseName);
assert.strictEqual(conn.authenticationType, connectionProfile.authenticationType);
assert.strictEqual(conn.password, connectionProfile.password);
assert.strictEqual(conn.userName, connectionProfile.userName);
assert.strictEqual(conn.groupId, connectionProfile.groupId);
assert.strictEqual(conn.groupFullName, connectionProfile.groupFullName);
assert.strictEqual(conn.savePassword, connectionProfile.savePassword);
});
test('getOptionsKey should create a valid unique id', () => {
let conn = new ConnectionProfile(capabilitiesService, connectionProfile);
let expectedId = 'providerName:MSSQL|authenticationType:|databaseName:database|serverName:new server|userName:user|databaseDisplayName:database|group:group id';
let id = conn.getOptionsKey();
assert.equal(id, expectedId);
assert.strictEqual(id, expectedId);
});
test('createFromStoredProfile should create connection profile from stored profile', () => {
let savedProfile = storedProfile;
let connectionProfile = ConnectionProfile.createFromStoredProfile(savedProfile, capabilitiesService);
assert.equal(savedProfile.groupId, connectionProfile.groupId);
assert.deepEqual(savedProfile.providerName, connectionProfile.providerName);
assert.deepEqual(savedProfile.savePassword, connectionProfile.savePassword);
assert.deepEqual(savedProfile.id, connectionProfile.id);
assert.strictEqual(savedProfile.groupId, connectionProfile.groupId);
assert.deepStrictEqual(savedProfile.providerName, connectionProfile.providerName);
assert.deepStrictEqual(savedProfile.savePassword, connectionProfile.savePassword);
assert.deepStrictEqual(savedProfile.id, connectionProfile.id);
});
test('createFromStoredProfile should set the id to new guid if not set in stored profile', () => {
let savedProfile: IConnectionProfileStore = Object.assign({}, storedProfile, { id: undefined });
let connectionProfile = ConnectionProfile.createFromStoredProfile(savedProfile, capabilitiesService);
assert.equal(savedProfile.groupId, connectionProfile.groupId);
assert.deepEqual(savedProfile.providerName, connectionProfile.providerName);
assert.equal(savedProfile.savePassword, connectionProfile.savePassword);
assert.notEqual(connectionProfile.id, undefined);
assert.equal(savedProfile.id, undefined);
assert.strictEqual(savedProfile.groupId, connectionProfile.groupId);
assert.deepStrictEqual(savedProfile.providerName, connectionProfile.providerName);
assert.strictEqual(savedProfile.savePassword, connectionProfile.savePassword);
assert.notStrictEqual(connectionProfile.id, undefined);
assert.strictEqual(savedProfile.id, undefined);
});
test('withoutPassword should create a new instance without password', () => {
let conn = new ConnectionProfile(capabilitiesService, connectionProfile);
assert.notEqual(conn.password, '');
assert.notStrictEqual(conn.password, '');
let withoutPassword = conn.withoutPassword();
assert.equal(withoutPassword.password, '');
assert.strictEqual(withoutPassword.password, '');
});
test('unique id should not include password', () => {
let conn = new ConnectionProfile(capabilitiesService, connectionProfile);
let withoutPassword = conn.withoutPassword();
assert.equal(withoutPassword.getOptionsKey(), conn.getOptionsKey());
assert.strictEqual(withoutPassword.getOptionsKey(), conn.getOptionsKey());
});
test('cloneWithDatabase should create new profile with new id', () => {
let conn = new ConnectionProfile(capabilitiesService, connectionProfile);
let newProfile = conn.cloneWithDatabase('new db');
assert.notEqual(newProfile.id, conn.id);
assert.equal(newProfile.databaseName, 'new db');
assert.notStrictEqual(newProfile.id, conn.id);
assert.strictEqual(newProfile.databaseName, 'new db');
});
test('an empty connection profile does not cause issues', () => {

View File

@@ -33,97 +33,97 @@ suite('SQL ConnectionProfileGroup tests', () => {
});
test('Root name should be returned as empty string', () => {
assert.equal(root.name, '');
assert.strictEqual(root.name, '');
});
test('Fullname should return the group full name correctly', () => {
assert.equal(group1Node.fullName, 'G1');
assert.equal(group2Node.fullName, 'G2');
assert.equal(group11Node.fullName, 'G1/G11');
assert.strictEqual(group1Node.fullName, 'G1');
assert.strictEqual(group2Node.fullName, 'G2');
assert.strictEqual(group11Node.fullName, 'G1/G11');
});
test('getGroupFullNameParts should return a list With ROOT in it given an empty string', () => {
let groupFullName: string = '';
let expected: string[] = [ConnectionProfileGroup.RootGroupName];
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('getGroupFullNameParts should return a list With ROOT in it given null', () => {
let groupFullName: string = undefined!;
let expected: string[] = [ConnectionProfileGroup.RootGroupName];
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('getGroupFullNameParts should return a list With ROOT in it given /', () => {
let groupFullName: string = '/';
let expected: string[] = [ConnectionProfileGroup.RootGroupName];
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('getGroupFullNameParts should add ROOT as first item if not added already and string starts with /', () => {
let groupFullName: string = '/Groups/Group1';
let expected: string[] = [ConnectionProfileGroup.RootGroupName, 'Groups', 'Group1'];
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('getGroupFullNameParts should add ROOT as first item if not added already', () => {
let groupFullName: string = 'Groups/Group1';
let expected: string[] = [ConnectionProfileGroup.RootGroupName, 'Groups', 'Group1'];
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('getGroupFullNameParts should not add ROOT if already added and string starts with /', () => {
let groupFullName: string = '/ROOT/Groups/Group1';
let expected: string[] = [ConnectionProfileGroup.RootGroupName, 'Groups', 'Group1'];
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('getGroupFullNameParts should not add ROOT if already added', () => {
let groupFullName: string = 'ROOT/Groups/Group1';
let expected: string[] = [ConnectionProfileGroup.RootGroupName, 'Groups', 'Group1'];
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('getGroupFullNameParts should not add ROOT if already added and it is not uppercase', () => {
let groupFullName: string = 'rOOT/Groups/Group1';
let expected: string[] = [ConnectionProfileGroup.RootGroupName, 'Groups', 'Group1'];
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('isRoot should return true given empty string', () => {
let name: string = '';
let expected: boolean = true;
let actual = ConnectionProfileGroup.isRoot(name);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('isRoot should return true given null', () => {
let name: string = undefined!;
let expected: boolean = true;
let actual = ConnectionProfileGroup.isRoot(name);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('isRoot should return true given /', () => {
let name: string = '/';
let expected: boolean = true;
let actual = ConnectionProfileGroup.isRoot(name);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('isRoot should return true given root', () => {
let name: string = 'root';
let expected: boolean = true;
let actual = ConnectionProfileGroup.isRoot(name);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('sameGroupName should return true given root', () => {
@@ -131,7 +131,7 @@ suite('SQL ConnectionProfileGroup tests', () => {
let name2: string = '';
let expected: boolean = true;
let actual = ConnectionProfileGroup.sameGroupName(name1, name2);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('sameGroupName should return true given same group names', () => {
@@ -139,7 +139,7 @@ suite('SQL ConnectionProfileGroup tests', () => {
let name2: string = '/Group1';
let expected: boolean = true;
let actual = ConnectionProfileGroup.sameGroupName(name1, name2);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('sameGroupName should return false given two different groups', () => {
@@ -147,15 +147,15 @@ suite('SQL ConnectionProfileGroup tests', () => {
let name2: string = '/Group1';
let expected: boolean = false;
let actual = ConnectionProfileGroup.sameGroupName(name1, name2);
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('test behavior when children is set to undefined', () => {
emptyGroup.children = undefined;
assert(emptyGroup.hasChildren() === false, 'Group should report no children after setting children to undefined');
const obj = emptyGroup.toObject();
assert.equal(obj.id, emptyGroup.id, 'toObject result has wrong id');
assert.equal(obj.name, emptyGroup.name, 'toObject result has wrong name');
assert.strictEqual(obj.id, emptyGroup.id, 'toObject result has wrong id');
assert.strictEqual(obj.name, emptyGroup.name, 'toObject result has wrong name');
assert(emptyGroup.hasValidConnections === true, 'Expected group to have valid connections');
const children = emptyGroup.getChildren();
assert(children.length === 0, 'Expected group to have 0 children');
@@ -165,11 +165,11 @@ suite('SQL ConnectionProfileGroup tests', () => {
emptyGroup.connections = undefined;
assert(emptyGroup.hasChildren() === false, 'Group should report no children after setting connections to undefined');
const obj = emptyGroup.toObject();
assert.equal(obj.id, emptyGroup.id, 'toObject result has wrong id');
assert.equal(obj.name, emptyGroup.name, 'toObject result has wrong name');
assert.strictEqual(obj.id, emptyGroup.id, 'toObject result has wrong id');
assert.strictEqual(obj.name, emptyGroup.name, 'toObject result has wrong name');
assert(emptyGroup.hasValidConnections === true, 'Expected group to have valid connections');
const children = emptyGroup.getChildren();
assert.equal(children.length, 0, 'Expected group to have 0 children');
assert.strictEqual(children.length, 0, 'Expected group to have 0 children');
});
test('test behavior with 1 child group', () => {
@@ -177,8 +177,8 @@ suite('SQL ConnectionProfileGroup tests', () => {
assert(emptyGroup.hasChildren() === true, 'Group should have children if 1 child group is added');
assert(emptyGroup.hasValidConnections === true, 'Expected group to have valid connections');
const children = emptyGroup.getChildren();
assert.equal(children.length, 1, 'Expected group to have 1 child');
assert.equal(children[0].id, group1Node.id, 'Expected group child to be group1Node');
assert.strictEqual(children.length, 1, 'Expected group to have 1 child');
assert.strictEqual(children[0].id, group1Node.id, 'Expected group child to be group1Node');
});
test('test behavior with 1 child connection', () => {
@@ -186,8 +186,8 @@ suite('SQL ConnectionProfileGroup tests', () => {
assert(emptyGroup.hasChildren(), 'Group should have children if 1 child group is added');
assert(emptyGroup.hasValidConnections === false, 'Expected group not to have valid connections');
const children = emptyGroup.getChildren();
assert.equal(children.length, 1, 'Expected group to have 1 child');
assert.equal(children[0].id, connectionProfile.id, 'Expected group child to be connectionProfile');
assert.strictEqual(children.length, 1, 'Expected group to have 1 child');
assert.strictEqual(children[0].id, connectionProfile.id, 'Expected group child to be connectionProfile');
});
test('adding undefined groups does nothing', () => {
@@ -197,8 +197,8 @@ suite('SQL ConnectionProfileGroup tests', () => {
emptyGroup.addGroups([group1Node]);
emptyGroup.addGroups(undefined);
const children = emptyGroup.getChildren();
assert.equal(children.length, 1, 'Expected group to have 1 child still');
assert.equal(children[0].id, group1Node.id, 'Expected group child to be group1Node');
assert.strictEqual(children.length, 1, 'Expected group to have 1 child still');
assert.strictEqual(children[0].id, group1Node.id, 'Expected group child to be group1Node');
});
test('adding undefined connections does nothing', () => {
@@ -208,7 +208,7 @@ suite('SQL ConnectionProfileGroup tests', () => {
emptyGroup.addConnections([connectionProfile]);
emptyGroup.addConnections(undefined);
const children = emptyGroup.getChildren();
assert.equal(children.length, 1, 'Expected group to have 1 child still');
assert.equal(children[0].id, connectionProfile.id, 'Expected group child to be connectionProfile');
assert.strictEqual(children.length, 1, 'Expected group to have 1 child still');
assert.strictEqual(children[0].id, connectionProfile.id, 'Expected group child to be connectionProfile');
});
});

View File

@@ -159,14 +159,14 @@ suite('ConnectionStore', () => {
await connectionStore.addRecentConnection(connectionProfile);
const current = connectionStore.getRecentlyUsedConnections();
if (i >= maxRecent) {
assert.equal(current.length, maxRecent, `expect only top ${maxRecent} creds to be saved`);
assert.strictEqual(current.length, maxRecent, `expect only top ${maxRecent} creds to be saved`);
} else {
assert.equal(current.length, i + 1, `expect all credentials to be saved ${current.length}|${i + 1} `);
assert.strictEqual(current.length, i + 1, `expect all credentials to be saved ${current.length}|${i + 1} `);
}
assert.equal(current[0].serverName, cred.serverName, 'Expect most recently saved item to be first in list');
assert.strictEqual(current[0].serverName, cred.serverName, 'Expect most recently saved item to be first in list');
assert.ok(!current[0].password);
}
assert.equal(credentialsService.credentials.size, numCreds);
assert.strictEqual(credentialsService.credentials.size, numCreds);
});
test('getRecentlyUsedConnections should return connection for given provider', () => {
@@ -196,8 +196,8 @@ suite('ConnectionStore', () => {
await connectionStore.addRecentConnection(connectionProfile);
await connectionStore.addRecentConnection(connectionProfile);
const current = connectionStore.getRecentlyUsedConnections();
assert.equal(current.length, 2, 'expect 2 unique credentials to have been added');
assert.equal(current[0].serverName, cred.serverName, 'Expect most recently saved item to be first in list');
assert.strictEqual(current.length, 2, 'expect 2 unique credentials to have been added');
assert.strictEqual(current[0].serverName, cred.serverName, 'Expect most recently saved item to be first in list');
assert.ok(!current[0].password);
});
@@ -231,7 +231,7 @@ 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(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.ok(!current[0].password);
@@ -240,24 +240,24 @@ suite('ConnectionStore', () => {
await connectionStore.addRecentConnection(integratedCredConnectionProfile);
current = connectionStore.getRecentlyUsedConnections();
// then expect not to have credential store called, but MRU count upped to 2
assert.equal(credentialsService.credentials.size, 1);
assert.equal(current.length, 2);
assert.strictEqual(credentialsService.credentials.size, 1);
assert.strictEqual(current.length, 2);
// When add connection without password
const noPwdCredConnectionProfile = new ConnectionProfile(capabilitiesService, noPwdCred);
await connectionStore.addRecentConnection(noPwdCredConnectionProfile);
current = connectionStore.getRecentlyUsedConnections();
// then expect not to have credential store called, but MRU count upped to 3
assert.equal(current.length, 3);
assert.equal(credentialsService.credentials.size, 1);
assert.strictEqual(current.length, 3);
assert.strictEqual(credentialsService.credentials.size, 1);
});
test('fixupConnectionCredentials should fix blank connection profile', () => {
let blankConnectionProfile = new ConnectionProfile(capabilitiesService, '');
let resultProfile = fixupConnectionCredentials(blankConnectionProfile);
assert.equal(resultProfile.serverName, '');
assert.equal(resultProfile.databaseName, '');
assert.equal(resultProfile.userName, '');
assert.equal(resultProfile.password, '');
assert.strictEqual(resultProfile.serverName, '');
assert.strictEqual(resultProfile.databaseName, '');
assert.strictEqual(resultProfile.userName, '');
assert.strictEqual(resultProfile.password, '');
});
test('can clear connections list', async () => {
@@ -270,10 +270,10 @@ suite('ConnectionStore', () => {
await connectionStore.addRecentConnection(defaultNamedProfile);
let result = connectionStore.getRecentlyUsedConnections();
assert.equal(result.length, 1);
assert.strictEqual(result.length, 1);
connectionStore.clearRecentlyUsed();
result = connectionStore.getRecentlyUsedConnections();
assert.equal(result.length, 0);
assert.strictEqual(result.length, 0);
// Then test is complete
});
@@ -340,7 +340,7 @@ suite('ConnectionStore', () => {
const profile = await connectionStore.saveProfile(connectionProfile);
// add connection should be called with a profile without password
assert.equal(profile.password, password, 'The returned profile should still keep the password');
assert.strictEqual(profile.password, password, 'The returned profile should still keep the password');
assert.ok(!!profile.groupId, 'Group id should be set in the profile');
});
@@ -352,7 +352,7 @@ suite('ConnectionStore', () => {
const connectionStore = new ConnectionStore(storageService, configurationService,
credentialsService, capabilitiesService);
const group = connectionStore.getGroupFromId('invalidId');
assert.equal(group, undefined, 'Returned group was not undefined when there was no group with the given ID');
assert.strictEqual(group, undefined, 'Returned group was not undefined when there was no group with the given ID');
});
test('getGroupFromId returns the group that has the given ID', () => {
@@ -386,11 +386,11 @@ suite('ConnectionStore', () => {
// If I look up the parent group using its ID, then I get back the correct group
let actualGroup = connectionStore.getGroupFromId(parentGroupId)!;
assert.equal(actualGroup.id, parentGroupId, 'Did not get the parent group when looking it up with its ID');
assert.strictEqual(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)!;
assert.equal(actualGroup.id, childGroupId, 'Did not get the child group when looking it up with its ID');
assert.strictEqual(actualGroup.id, childGroupId, 'Did not get the child group when looking it up with its ID');
});
test('getProfileWithoutPassword can return the profile without credentials in the password property or options dictionary', () => {
@@ -408,7 +408,7 @@ suite('ConnectionStore', () => {
expectedProfile.options['password'] = '';
expectedProfile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, expectedProfile).toIConnectionProfile();
let profileWithoutCredentials = connectionStore.getProfileWithoutPassword(profile);
assert.deepEqual(profileWithoutCredentials.toIConnectionProfile(), expectedProfile);
assert.deepStrictEqual(profileWithoutCredentials.toIConnectionProfile(), expectedProfile);
});
test('addPassword gets the password from the credentials service', async () => {
@@ -428,7 +428,7 @@ suite('ConnectionStore', () => {
const passwordProfile = (await connectionStore.addSavedPassword(profile)).profile;
assert.equal(passwordProfile.password, password);
assert.strictEqual(passwordProfile.password, password);
});
test('getConnectionProfileGroups', async () => {
@@ -481,7 +481,7 @@ suite('ConnectionStore', () => {
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
await connectionStore.addRecentConnection(connectionProfile);
const current = connectionStore.getRecentlyUsedConnections();
assert.equal(current.length, i + 1);
assert.strictEqual(current.length, i + 1);
}
for (let i = 0; i < 5; i++) {
@@ -489,7 +489,7 @@ suite('ConnectionStore', () => {
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
connectionStore.removeRecentConnection(connectionProfile);
const current = connectionStore.getRecentlyUsedConnections();
assert.equal(current.length, 4 - i);
assert.strictEqual(current.length, 4 - i);
}
});
@@ -533,6 +533,6 @@ suite('ConnectionStore', () => {
const connections = connectionStore.getRecentlyUsedConnections();
assert.equal(connections[0].groupFullName, parentGroupName);
assert.strictEqual(connections[0].groupFullName, parentGroupName);
});
});

View File

@@ -132,62 +132,62 @@ suite('SQL ProviderConnectionInfo tests', () => {
test('constructor should accept undefined parameters', () => {
let conn = new ProviderConnectionInfo(undefined!, undefined!);
assert.equal(conn.serverName, undefined);
assert.strictEqual(conn.serverName, undefined);
});
test('set properties should set the values correctly', () => {
let conn = new ProviderConnectionInfo(capabilitiesService, mssqlProviderName);
assert.equal(conn.serverName, undefined);
assert.strictEqual(conn.serverName, undefined);
conn.connectionName = connectionProfile.connectionName!;
conn.serverName = connectionProfile.serverName;
conn.databaseName = connectionProfile.databaseName!;
conn.authenticationType = connectionProfile.authenticationType;
conn.password = connectionProfile.password;
conn.userName = connectionProfile.userName;
assert.equal(conn.connectionName, connectionProfile.connectionName);
assert.equal(conn.serverName, connectionProfile.serverName);
assert.equal(conn.databaseName, connectionProfile.databaseName);
assert.equal(conn.authenticationType, connectionProfile.authenticationType);
assert.equal(conn.password, connectionProfile.password);
assert.equal(conn.userName, connectionProfile.userName);
assert.strictEqual(conn.connectionName, connectionProfile.connectionName);
assert.strictEqual(conn.serverName, connectionProfile.serverName);
assert.strictEqual(conn.databaseName, connectionProfile.databaseName);
assert.strictEqual(conn.authenticationType, connectionProfile.authenticationType);
assert.strictEqual(conn.password, connectionProfile.password);
assert.strictEqual(conn.userName, connectionProfile.userName);
});
test('set properties should store the values in the options', () => {
let conn = new ProviderConnectionInfo(capabilitiesService, mssqlProviderName);
assert.equal(conn.serverName, undefined);
assert.strictEqual(conn.serverName, undefined);
conn.serverName = connectionProfile.serverName;
conn.databaseName = connectionProfile.databaseName!;
conn.authenticationType = connectionProfile.authenticationType;
conn.password = connectionProfile.password;
conn.userName = connectionProfile.userName;
assert.equal(conn.getOptionValue('serverName'), connectionProfile.serverName);
assert.equal(conn.getOptionValue('databaseName'), connectionProfile.databaseName);
assert.equal(conn.getOptionValue('authenticationType'), connectionProfile.authenticationType);
assert.equal(conn.getOptionValue('password'), connectionProfile.password);
assert.equal(conn.getOptionValue('userName'), connectionProfile.userName);
assert.strictEqual(conn.getOptionValue('serverName'), connectionProfile.serverName);
assert.strictEqual(conn.getOptionValue('databaseName'), connectionProfile.databaseName);
assert.strictEqual(conn.getOptionValue('authenticationType'), connectionProfile.authenticationType);
assert.strictEqual(conn.getOptionValue('password'), connectionProfile.password);
assert.strictEqual(conn.getOptionValue('userName'), connectionProfile.userName);
});
test('constructor should initialize the options given a valid model', () => {
let conn = new ProviderConnectionInfo(capabilitiesService, connectionProfile);
assert.equal(conn.connectionName, connectionProfile.connectionName);
assert.equal(conn.serverName, connectionProfile.serverName);
assert.equal(conn.databaseName, connectionProfile.databaseName);
assert.equal(conn.authenticationType, connectionProfile.authenticationType);
assert.equal(conn.password, connectionProfile.password);
assert.equal(conn.userName, connectionProfile.userName);
assert.strictEqual(conn.connectionName, connectionProfile.connectionName);
assert.strictEqual(conn.serverName, connectionProfile.serverName);
assert.strictEqual(conn.databaseName, connectionProfile.databaseName);
assert.strictEqual(conn.authenticationType, connectionProfile.authenticationType);
assert.strictEqual(conn.password, connectionProfile.password);
assert.strictEqual(conn.userName, connectionProfile.userName);
});
test('clone should create a new instance that equals the old one', () => {
let conn = new ProviderConnectionInfo(capabilitiesService, connectionProfile);
let conn2 = conn.clone();
assert.equal(conn.connectionName, conn2.connectionName);
assert.equal(conn.serverName, conn2.serverName);
assert.equal(conn.databaseName, conn2.databaseName);
assert.equal(conn.authenticationType, conn2.authenticationType);
assert.equal(conn.password, conn2.password);
assert.equal(conn.userName, conn2.userName);
assert.strictEqual(conn.connectionName, conn2.connectionName);
assert.strictEqual(conn.serverName, conn2.serverName);
assert.strictEqual(conn.databaseName, conn2.databaseName);
assert.strictEqual(conn.authenticationType, conn2.authenticationType);
assert.strictEqual(conn.password, conn2.password);
assert.strictEqual(conn.userName, conn2.userName);
});
test('Changing the cloned object should not change the original one', () => {
@@ -195,7 +195,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
let conn2 = conn.clone();
conn2.serverName = conn.serverName + '1';
assert.notEqual(conn.serverName, conn2.serverName);
assert.notStrictEqual(conn.serverName, conn2.serverName);
});
test('constructor should initialize the options given a valid model with options', () => {
@@ -204,44 +204,44 @@ suite('SQL ProviderConnectionInfo tests', () => {
let conn2 = Object.assign({}, connectionProfile, { options: options });
let conn = new ProviderConnectionInfo(capabilitiesService, conn2);
assert.equal(conn.connectionName, conn2.connectionName);
assert.equal(conn.serverName, conn2.serverName);
assert.equal(conn.databaseName, conn2.databaseName);
assert.equal(conn.authenticationType, conn2.authenticationType);
assert.equal(conn.password, conn2.password);
assert.equal(conn.userName, conn2.userName);
assert.equal(conn.options['encrypt'], 'test value');
assert.strictEqual(conn.connectionName, conn2.connectionName);
assert.strictEqual(conn.serverName, conn2.serverName);
assert.strictEqual(conn.databaseName, conn2.databaseName);
assert.strictEqual(conn.authenticationType, conn2.authenticationType);
assert.strictEqual(conn.password, conn2.password);
assert.strictEqual(conn.userName, conn2.userName);
assert.strictEqual(conn.options['encrypt'], 'test value');
});
test('getOptionsKey should create a valid unique id', () => {
let conn = new ProviderConnectionInfo(capabilitiesService, connectionProfile);
let expectedId = 'providerName:MSSQL|authenticationType:|databaseName:database|serverName:new server|userName:user';
let id = conn.getOptionsKey();
assert.equal(id, expectedId);
assert.strictEqual(id, expectedId);
});
test('getOptionsKey should create different id for different server names', () => {
let conn = new ProviderConnectionInfo(capabilitiesService, connectionProfile);
let conn2 = new ProviderConnectionInfo(capabilitiesService, Object.assign({}, connectionProfile, { serverName: connectionProfile.serverName + '1' }));
assert.notEqual(conn.getOptionsKey(), conn2.getOptionsKey());
assert.notStrictEqual(conn.getOptionsKey(), conn2.getOptionsKey());
});
test('titleParts should return server, database and auth type as first items', () => {
let conn = new ProviderConnectionInfo(capabilitiesService, connectionProfile);
let titleParts = conn.titleParts;
assert.equal(titleParts.length, 4);
assert.equal(titleParts[0], connectionProfile.serverName);
assert.equal(titleParts[1], connectionProfile.databaseName);
assert.equal(titleParts[2], connectionProfile.authenticationType);
assert.equal(titleParts[3], connectionProfile.userName);
assert.strictEqual(titleParts.length, 4);
assert.strictEqual(titleParts[0], connectionProfile.serverName);
assert.strictEqual(titleParts[1], connectionProfile.databaseName);
assert.strictEqual(titleParts[2], connectionProfile.authenticationType);
assert.strictEqual(titleParts[3], connectionProfile.userName);
});
test('getProviderFromOptionsKey should return the provider name from the options key successfully', () => {
let optionsKey = `providerName:${mssqlProviderName}|authenticationType:|databaseName:database|serverName:new server|userName:user`;
let actual = ProviderConnectionInfo.getProviderFromOptionsKey(optionsKey);
assert.equal(mssqlProviderName, actual);
assert.strictEqual(mssqlProviderName, actual);
});
test('getProviderFromOptionsKey should return empty string give null', () => {
@@ -249,7 +249,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
let expectedProviderId: string = '';
let actual = ProviderConnectionInfo.getProviderFromOptionsKey(optionsKey);
assert.equal(expectedProviderId, actual);
assert.strictEqual(expectedProviderId, actual);
});
test('getProviderFromOptionsKey should return empty string give key without provider name', () => {
@@ -257,6 +257,6 @@ suite('SQL ProviderConnectionInfo tests', () => {
let expectedProviderId: string = '';
let actual = ProviderConnectionInfo.getProviderFromOptionsKey(optionsKey);
assert.equal(expectedProviderId, actual);
assert.strictEqual(expectedProviderId, actual);
});
});

View File

@@ -95,40 +95,40 @@ suite('SQL ConnectionStatusManager tests', () => {
let id: string = 'invalid id';
let expected = undefined;
let actual = connections.findConnection(id);
assert.equal(actual, expected);
assert.strictEqual(actual, expected);
});
test('findConnection should return connection given valid id', () => {
let id: string = connection1Id;
let actual = connections.findConnection(id);
assert.equal(connectionProfileObject.matches(actual!.connectionProfile), true);
assert.strictEqual(connectionProfileObject.matches(actual!.connectionProfile), true);
});
test('getConnectionProfile should return undefined given invalid id', () => {
let id: string = 'invalid id';
let expected = undefined;
let actual = connections.getConnectionProfile(id);
assert.equal(actual, expected);
assert.strictEqual(actual, expected);
});
test('getConnectionProfile should return connection given valid id', () => {
let id: string = connection1Id;
let actual = connections.getConnectionProfile(id);
assert.equal(connectionProfileObject.matches(actual!), true);
assert.strictEqual(connectionProfileObject.matches(actual!), true);
});
test('hasConnection should return false given invalid id', () => {
let id: string = 'invalid id';
let expected = false;
let actual = connections.hasConnection(id);
assert.equal(actual, expected);
assert.strictEqual(actual, expected);
});
test('hasConnection should return true given valid id', () => {
let id: string = connection1Id;
let expected = true;
let actual = connections.hasConnection(id);
assert.equal(actual, expected);
assert.strictEqual(actual, expected);
});
test('addConnection should set connecting to true', () => {
@@ -144,7 +144,7 @@ suite('SQL ConnectionStatusManager tests', () => {
};
connections.onConnectionComplete(summary);
let actual = connections.addConnection(connectionProfile, connection1Id).connecting;
assert.equal(actual, expected);
assert.strictEqual(actual, expected);
});
test('onConnectionComplete should set connecting to false', () => {
@@ -160,9 +160,9 @@ suite('SQL ConnectionStatusManager tests', () => {
};
connections.onConnectionComplete(summary);
let actual = connections.findConnection(connection1Id)!.connecting;
assert.equal(actual, expected);
assert.strictEqual(actual, expected);
actual = connections.isConnecting(connection1Id);
assert.equal(actual, expected);
assert.strictEqual(actual, expected);
});
test('updateConnection should update the connection info', () => {
@@ -176,9 +176,9 @@ suite('SQL ConnectionStatusManager tests', () => {
let newId = Utils.generateUri(updatedConnection);
let actual = connections.getConnectionProfile(newId)!.groupId;
let actualConnectionId = connections.getConnectionProfile(newId)!.id;
assert.equal(actual, expected);
assert.equal(actualId, newId);
assert.equal(actualConnectionId, expectedConnectionId);
assert.strictEqual(actual, expected);
assert.strictEqual(actualId, newId);
assert.strictEqual(actualConnectionId, expectedConnectionId);
});
test('updateDatabaseName should update the database name in connection', () => {
@@ -204,7 +204,7 @@ suite('SQL ConnectionStatusManager tests', () => {
//Verify database name changed after connection is complete
connections.updateDatabaseName(summary);
connectionStatus = connections.findConnection(connection3Id);
assert.equal(connectionStatus!.connectionProfile.databaseName, dbName);
assert.strictEqual(connectionStatus!.connectionProfile.databaseName, dbName);
});
test('getOriginalOwnerUri should return the original uri given uri with db name', () => {
@@ -234,13 +234,13 @@ suite('SQL ConnectionStatusManager tests', () => {
//The uri assigned to connection without db name should be the original one
let connectionWitDbStatus = connections.getOriginalOwnerUri(ownerUriWithDbName);
assert.equal(connectionWitDbStatus, connection3Id);
assert.strictEqual(connectionWitDbStatus, connection3Id);
});
test('getOriginalOwnerUri should return given uri if the original uri is the same as the given uri', () => {
let connectionStatus = connections.getOriginalOwnerUri(connection2Id);
assert.equal(connectionStatus, connection2Id);
assert.strictEqual(connectionStatus, connection2Id);
});
test('getActiveConnectionProfiles should return a list of all the unique connections that the status manager knows about', () => {
@@ -254,7 +254,7 @@ suite('SQL ConnectionStatusManager tests', () => {
// Get the connections and verify that the duplicate is only returned once
let activeConnections = connections.getActiveConnectionProfiles();
assert.equal(activeConnections.length, 4);
assert.equal(activeConnections.filter(connection => connection.matches(newConnection)).length, 1, 'Did not find newConnection in active connections');
assert.strictEqual(activeConnections.length, 4);
assert.strictEqual(activeConnections.filter(connection => connection.matches(newConnection)).length, 1, 'Did not find newConnection in active connections');
});
});