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

@@ -281,7 +281,7 @@ suite('ConnectionDialogService tests', () => {
Also openDialogAndWait returns the connection profile passed in */
(connectionDialogService as any).handleDefaultOnConnect(testConnectionParams, connectionProfile);
let result = await connectionPromise;
assert.equal(result, connectionProfile);
assert.strictEqual(result, connectionProfile);
});
test('handleFillInConnectionInputs calls function on ConnectionController widget', async () => {
@@ -292,7 +292,7 @@ suite('ConnectionDialogService tests', () => {
await connectionDialogService.showDialog(mockConnectionManagementService.object, testConnectionParams, connectionProfile);
await (connectionDialogService as any).handleFillInConnectionInputs(connectionProfile);
let returnedModel = ((connectionDialogService as any)._connectionControllerMap['MSSQL'] as any)._model;
assert.equal(returnedModel._groupName, 'testGroup');
assert.strictEqual(returnedModel._groupName, 'testGroup');
assert(called);
});

View File

@@ -76,8 +76,8 @@ suite('ConnectionDialogWidget tests', () => {
});
test('renderBody should have attached a connection dialog body onto element', () => {
assert.equal(element.childElementCount, 1);
assert.equal(element.children[0].className, 'connection-dialog');
assert.strictEqual(element.childElementCount, 1);
assert.strictEqual(element.children[0].className, 'connection-dialog');
});
test('updateConnectionProviders should update connection providers', () => {
@@ -87,7 +87,7 @@ suite('ConnectionDialogWidget tests', () => {
return getUniqueConnectionProvidersByNameMap(providerNameToDisplayMap);
});
connectionDialogWidget.updateConnectionProviders(providerDisplayNames, providerNameToDisplayMap);
assert.equal(connectionDialogWidget.getDisplayNameFromProviderName('PGSQL'), providerNameToDisplayMap['PGSQL']);
assert.strictEqual(connectionDialogWidget.getDisplayNameFromProviderName('PGSQL'), providerNameToDisplayMap['PGSQL']);
});
test('setting newConnectionParams test for connectionDialogWidget', () => {
@@ -109,7 +109,7 @@ suite('ConnectionDialogWidget tests', () => {
return getUniqueConnectionProvidersByNameMap(providerNameToDisplayMap);
});
connectionDialogWidget.newConnectionParams = params;
assert.equal(connectionDialogWidget.newConnectionParams, params);
assert.strictEqual(connectionDialogWidget.newConnectionParams, params);
});
test('open should call onInitDialog', async () => {
@@ -176,8 +176,8 @@ suite('ConnectionDialogWidget tests', () => {
});
let providerDisplayName = 'Mock SQL Server';
connectionDialogWidget.updateProvider(providerDisplayName);
assert.equal(returnedDisplayName, providerDisplayName);
assert.equal(returnedContainer.className, 'connection-provider-info');
assert.strictEqual(returnedDisplayName, providerDisplayName);
assert.strictEqual(returnedContainer.className, 'connection-provider-info');
assert(called);
});
});

View File

@@ -299,8 +299,8 @@ suite('SQL ConnectionManagementService tests', () => {
await connect(params.input.uri);
let saveConnection = connectionManagementService.getConnectionProfile(params.input.uri);
assert.notEqual(saveConnection, undefined, `profile was not added to the connections`);
assert.equal(saveConnection.serverName, connectionProfile.serverName, `Server names are different`);
assert.notStrictEqual(saveConnection, undefined, `profile was not added to the connections`);
assert.strictEqual(saveConnection.serverName, connectionProfile.serverName, `Server names are different`);
await connectionManagementService.showConnectionDialog(params);
verifyShowConnectionDialog(connectionProfile, params.connectionType, params.input.uri, false);
});
@@ -326,7 +326,7 @@ suite('SQL ConnectionManagementService tests', () => {
test('getDefaultProviderId is MSSQL', () => {
let defaultProvider = connectionManagementService.getDefaultProviderId();
assert.equal(defaultProvider, 'MSSQL', `Default provider is not equal to MSSQL`);
assert.strictEqual(defaultProvider, 'MSSQL', `Default provider is not equal to MSSQL`);
});
/* Andresse 10/5/17 commented this test out since it was only working before my changes by the chance of how Promises work
@@ -372,8 +372,8 @@ suite('SQL ConnectionManagementService tests', () => {
await connect(uri, options);
verifyOptions(options);
assert.notEqual(paramsInOnConnectSuccess, undefined);
assert.equal(paramsInOnConnectSuccess.connectionType, options.params.connectionType);
assert.notStrictEqual(paramsInOnConnectSuccess, undefined);
assert.strictEqual(paramsInOnConnectSuccess.connectionType, options.params.connectionType);
});
test('connectAndSaveProfile should show not load the password', async () => {
@@ -389,7 +389,7 @@ suite('SQL ConnectionManagementService tests', () => {
let options: IConnectionCompletionOptions = undefined;
await connect(uri, options);
assert.equal(connectionManagementService.isProfileConnected(connectionProfile), true);
assert.strictEqual(connectionManagementService.isProfileConnected(connectionProfile), true);
});
test('failed connection should open the dialog if connection fails', async () => {
@@ -414,8 +414,8 @@ suite('SQL ConnectionManagementService tests', () => {
};
let result = await connect(uri, options, false, connectionProfile, error, errorCode, errorCallStack);
assert.equal(result.connected, expectedConnection);
assert.equal(result.errorMessage, connectionResult.errorMessage);
assert.strictEqual(result.connected, expectedConnection);
assert.strictEqual(result.errorMessage, connectionResult.errorMessage);
verifyShowFirewallRuleDialog(connectionProfile, false);
verifyShowConnectionDialog(connectionProfile, ConnectionType.default, uri, true, connectionResult);
});
@@ -442,19 +442,19 @@ suite('SQL ConnectionManagementService tests', () => {
};
let result = await connect(uri, options, false, connectionProfile, error, errorCode, errorCallStack);
assert.equal(result.connected, expectedConnection);
assert.equal(result.errorMessage, connectionResult.errorMessage);
assert.strictEqual(result.connected, expectedConnection);
assert.strictEqual(result.errorMessage, connectionResult.errorMessage);
verifyShowFirewallRuleDialog(connectionProfile, false);
verifyShowConnectionDialog(connectionProfile, ConnectionType.default, uri, true, connectionResult, false);
});
test('Accessors for event emitters should return emitter function', () => {
let onAddConnectionProfile1 = connectionManagementService.onAddConnectionProfile;
assert.equal(typeof (onAddConnectionProfile1), 'function');
assert.strictEqual(typeof (onAddConnectionProfile1), 'function');
let onDeleteConnectionProfile1 = connectionManagementService.onDeleteConnectionProfile;
assert.equal(typeof (onDeleteConnectionProfile1), 'function');
assert.strictEqual(typeof (onDeleteConnectionProfile1), 'function');
let onConnect1 = connectionManagementService.onConnect;
assert.equal(typeof (onConnect1), 'function');
assert.strictEqual(typeof (onConnect1), 'function');
});
test('onConnectionChangedNotification should call onConnectionChanged event', async () => {
@@ -472,8 +472,8 @@ suite('SQL ConnectionManagementService tests', () => {
let changedConnectionInfo: azdata.ChangedConnectionInfo = { connectionUri: uri, connection: saveConnection };
let called = false;
connectionManagementService.onConnectionChanged((params: IConnectionParams) => {
assert.equal(uri, params.connectionUri);
assert.equal(saveConnection, params.connectionProfile);
assert.strictEqual(uri, params.connectionUri);
assert.strictEqual(saveConnection, params.connectionProfile);
called = true;
});
connectionManagementService.onConnectionChangedNotification(0, changedConnectionInfo);
@@ -487,7 +487,7 @@ suite('SQL ConnectionManagementService tests', () => {
let newGroupId = 'new_group_id';
connectionStore.setup(x => x.changeGroupIdForConnection(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve());
await connectionManagementService.changeGroupIdForConnection(profile, newGroupId);
assert.equal(profile.groupId, newGroupId);
assert.strictEqual(profile.groupId, newGroupId);
});
test('changeGroupIdForConnectionGroup should call changeGroupIdForConnectionGroup in ConnectionStore', async () => {
@@ -530,7 +530,7 @@ suite('SQL ConnectionManagementService tests', () => {
+ profile.serverName + '|userName:' + profile.userName;
await connect(uri1, options, true, profile);
let returnedProfile = connectionManagementService.findExistingConnection(profile);
assert.equal(returnedProfile.getConnectionInfoId(), connectionInfoString);
assert.strictEqual(returnedProfile.getConnectionInfoId(), connectionInfoString);
});
test('deleteConnection should delete the connection properly', async () => {
@@ -745,7 +745,7 @@ suite('SQL ConnectionManagementService tests', () => {
await connect(uri, options);
let result = await connectionManagementService.cancelEditorConnection(options.params.input);
assert.equal(result, false);
assert.strictEqual(result, false);
assert(connectionManagementService.isConnected(uri));
});
@@ -776,10 +776,10 @@ suite('SQL ConnectionManagementService tests', () => {
await connect(uri, options, true, profile);
// invalid uri check.
assert.equal(connectionManagementService.getConnection(badString), undefined);
assert.strictEqual(connectionManagementService.getConnection(badString), undefined);
let returnedProfile = connectionManagementService.getConnection(uri);
assert.equal(returnedProfile.groupFullName, profile.groupFullName);
assert.equal(returnedProfile.groupId, profile.groupId);
assert.strictEqual(returnedProfile.groupFullName, profile.groupFullName);
assert.strictEqual(returnedProfile.groupId, profile.groupId);
});
test('connectIfNotConnected should not try to connect with already connected profile', async () => {
@@ -808,12 +808,12 @@ suite('SQL ConnectionManagementService tests', () => {
await connect(uri, options, true, profile);
let result = await connectionManagementService.connectIfNotConnected(profile, undefined, true);
assert.equal(result, uri);
assert.strictEqual(result, uri);
});
test('getServerInfo should return undefined when given an invalid string', () => {
let badString = 'bad_string';
assert.equal(connectionManagementService.getServerInfo(badString), undefined);
assert.strictEqual(connectionManagementService.getServerInfo(badString), undefined);
});
test('getConnectionString should get connection string of connectionId', async () => {
@@ -843,7 +843,7 @@ suite('SQL ConnectionManagementService tests', () => {
let getConnectionResult = await connectionManagementService.getConnectionString(badString);
// test for invalid profile id
assert.equal(getConnectionResult, undefined);
assert.strictEqual(getConnectionResult, undefined);
await connect(uri, options, true, profile);
let currentConnections = connectionManagementService.getConnections(true);
let profileId = currentConnections[0].id;
@@ -923,7 +923,7 @@ suite('SQL ConnectionManagementService tests', () => {
});
await connect(uri, options, true, profile);
let result = await connectionManagementService.buildConnectionInfo(testConnectionString, providerName);
assert.equal(result.options, options);
assert.strictEqual(result.options, options);
});
test('removeConnectionProfileCredentials should return connection profile without password', () => {
@@ -934,7 +934,7 @@ suite('SQL ConnectionManagementService tests', () => {
return <ConnectionProfile>profileWithoutPass;
});
let clearedProfile = connectionManagementService.removeConnectionProfileCredentials(profile);
assert.equal(clearedProfile.password, undefined);
assert.strictEqual(clearedProfile.password, undefined);
});
test('getConnectionProfileById should return profile when given profileId', async () => {
@@ -962,13 +962,13 @@ suite('SQL ConnectionManagementService tests', () => {
showFirewallRuleOnError: true
};
let result = await connect(uri, options, true, profile);
assert.equal(result.connected, true);
assert.equal(connectionManagementService.getConnectionProfileById(badString), undefined);
assert.strictEqual(result.connected, true);
assert.strictEqual(connectionManagementService.getConnectionProfileById(badString), undefined);
let currentConnections = connectionManagementService.getConnections(true);
let profileId = currentConnections[0].id;
let returnedProfile = connectionManagementService.getConnectionProfileById(profileId);
assert.equal(returnedProfile.groupFullName, profile.groupFullName);
assert.equal(returnedProfile.groupId, profile.groupId);
assert.strictEqual(returnedProfile.groupFullName, profile.groupFullName);
assert.strictEqual(returnedProfile.groupId, profile.groupId);
});
test('Edit Connection - Changing connection profile name for same URI should persist after edit', async () => {
@@ -1001,7 +1001,7 @@ suite('SQL ConnectionManagementService tests', () => {
newProfile.connectionName = newname;
options.params.isEditConnection = true;
await connect(uri1, options, true, newProfile);
assert.equal(connectionManagementService.getConnectionProfile(uri1).connectionName, newname);
assert.strictEqual(connectionManagementService.getConnectionProfile(uri1).connectionName, newname);
});
test('Edit Connection - Connecting a different URI with same profile via edit should not change profile ID.', async () => {
@@ -1035,7 +1035,7 @@ suite('SQL ConnectionManagementService tests', () => {
await connect(uri2, options, true, profile);
let uri1info = connectionManagementService.getConnectionInfo(uri1);
let uri2info = connectionManagementService.getConnectionInfo(uri2);
assert.equal(uri1info.connectionProfile.id, uri2info.connectionProfile.id);
assert.strictEqual(uri1info.connectionProfile.id, uri2info.connectionProfile.id);
});
@@ -1058,8 +1058,8 @@ suite('SQL ConnectionManagementService tests', () => {
};
let result = await connect(uri, options, false, connectionProfile, error, errorCode);
assert.equal(result.connected, expectedConnection);
assert.equal(result.errorMessage, expectedError);
assert.strictEqual(result.connected, expectedConnection);
assert.strictEqual(result.errorMessage, expectedError);
verifyShowFirewallRuleDialog(connectionProfile, true);
});
@@ -1089,8 +1089,8 @@ suite('SQL ConnectionManagementService tests', () => {
};
let result = await connect(uri, options, false, connectionProfile, error, errorCode, errorCallStack);
assert.equal(result.connected, expectedConnection);
assert.equal(result.errorMessage, connectionResult.errorMessage);
assert.strictEqual(result.connected, expectedConnection);
assert.strictEqual(result.errorMessage, connectionResult.errorMessage);
verifyShowFirewallRuleDialog(connectionProfile, false);
verifyShowConnectionDialog(connectionProfile, ConnectionType.default, uri, true, connectionResult, false);
});
@@ -1101,25 +1101,25 @@ suite('SQL ConnectionManagementService tests', () => {
test('getConnectionIconId should return undefined as there is no mementoObj service', () => {
let connectionId = 'connection:connectionId';
assert.equal(connectionManagementService.getConnectionIconId(connectionId), undefined);
assert.strictEqual(connectionManagementService.getConnectionIconId(connectionId), undefined);
});
test('getAdvancedProperties should return a list of properties for connectionManagementService', () => {
let propertyNames = ['connectionName', 'serverName', 'databaseName', 'userName', 'authenticationType', 'password'];
let advancedProperties = connectionManagementService.getAdvancedProperties();
assert.equal(propertyNames[0], advancedProperties[0].name);
assert.equal(propertyNames[1], advancedProperties[1].name);
assert.equal(propertyNames[2], advancedProperties[2].name);
assert.equal(propertyNames[3], advancedProperties[3].name);
assert.equal(propertyNames[4], advancedProperties[4].name);
assert.equal(propertyNames[5], advancedProperties[5].name);
assert.strictEqual(propertyNames[0], advancedProperties[0].name);
assert.strictEqual(propertyNames[1], advancedProperties[1].name);
assert.strictEqual(propertyNames[2], advancedProperties[2].name);
assert.strictEqual(propertyNames[3], advancedProperties[3].name);
assert.strictEqual(propertyNames[4], advancedProperties[4].name);
assert.strictEqual(propertyNames[5], advancedProperties[5].name);
});
test('saveProfileGroup should return groupId from connection group', async () => {
let newConnectionGroup = createConnectionGroup(connectionProfile.groupId);
connectionStore.setup(x => x.saveProfileGroup(TypeMoq.It.isAny())).returns(() => Promise.resolve(connectionProfile.groupId));
let result = await connectionManagementService.saveProfileGroup(newConnectionGroup);
assert.equal(result, connectionProfile.groupId);
assert.strictEqual(result, connectionProfile.groupId);
});
test('editGroup should fire onAddConnectionProfile', async () => {
@@ -1137,10 +1137,10 @@ suite('SQL ConnectionManagementService tests', () => {
let testUri = 'connection:';
let formattedUri = 'connection:connectionId';
let badUri = 'bad_uri';
assert.equal(formattedUri, connectionManagementService.getFormattedUri(testUri, connectionProfile));
assert.equal(formattedUri, connectionManagementService.getFormattedUri(formattedUri, connectionProfile));
assert.strictEqual(formattedUri, connectionManagementService.getFormattedUri(testUri, connectionProfile));
assert.strictEqual(formattedUri, connectionManagementService.getFormattedUri(formattedUri, connectionProfile));
// test for invalid URI
assert.equal(badUri, connectionManagementService.getFormattedUri(badUri, connectionProfile));
assert.strictEqual(badUri, connectionManagementService.getFormattedUri(badUri, connectionProfile));
});
test('failed firewall rule connection and failed during open firewall rule should open the firewall rule dialog and connection dialog with error', async () => {
@@ -1169,8 +1169,8 @@ suite('SQL ConnectionManagementService tests', () => {
};
let result = await connect(uri, options, false, connectionProfile, error, errorCode, errorCallStack);
assert.equal(result.connected, expectedConnection);
assert.equal(result.errorMessage, connectionResult.errorMessage);
assert.strictEqual(result.connected, expectedConnection);
assert.strictEqual(result.errorMessage, connectionResult.errorMessage);
verifyShowFirewallRuleDialog(connectionProfile, true);
verifyShowConnectionDialog(connectionProfile, ConnectionType.default, uri, true, connectionResult, true);
});
@@ -1201,7 +1201,7 @@ suite('SQL ConnectionManagementService tests', () => {
};
let result = await connect(uri, options, false, connectionProfile, error, errorCode, errorCallStack);
assert.equal(result, undefined);
assert.strictEqual(result, undefined);
verifyShowFirewallRuleDialog(connectionProfile, true);
verifyShowConnectionDialog(connectionProfile, ConnectionType.default, uri, true, connectionResult, false);
});
@@ -1225,8 +1225,8 @@ suite('SQL ConnectionManagementService tests', () => {
};
let result = await connect(uri, options, false, connectionProfileWithEmptyUnsavedPassword);
assert.equal(result.connected, expectedConnection);
assert.equal(result.errorMessage, connectionResult.errorMessage);
assert.strictEqual(result.connected, expectedConnection);
assert.strictEqual(result.errorMessage, connectionResult.errorMessage);
verifyShowConnectionDialog(connectionProfileWithEmptyUnsavedPassword, ConnectionType.default, uri, true, connectionResult);
verifyShowFirewallRuleDialog(connectionProfile, false);
});
@@ -1250,8 +1250,8 @@ suite('SQL ConnectionManagementService tests', () => {
};
let result = await connect(uri, options, false, connectionProfileWithEmptySavedPassword);
assert.equal(result.connected, expectedConnection);
assert.equal(result.errorMessage, connectionResult.errorMessage);
assert.strictEqual(result.connected, expectedConnection);
assert.strictEqual(result.errorMessage, connectionResult.errorMessage);
verifyShowConnectionDialog(connectionProfileWithEmptySavedPassword, ConnectionType.default, uri, true, connectionResult, false);
});
@@ -1286,8 +1286,8 @@ suite('SQL ConnectionManagementService tests', () => {
};
let result = await connect(uri, options, false, connectionProfileWithEmptySavedPassword);
assert.equal(result.connected, expectedConnection);
assert.equal(result.errorMessage, connectionResult.errorMessage);
assert.strictEqual(result.connected, expectedConnection);
assert.strictEqual(result.errorMessage, connectionResult.errorMessage);
verifyShowConnectionDialog(connectionProfileWithEmptySavedPassword, ConnectionType.editor, uri, true, connectionResult, false);
});
@@ -1383,8 +1383,8 @@ suite('SQL ConnectionManagementService tests', () => {
let pgsqlId = 'PGSQL';
let mssqlProperties = connectionManagementService.getProviderProperties('MSSQL');
let pgsqlProperties = connectionManagementService.getProviderProperties('PGSQL');
assert.equal(mssqlProperties.providerId, mssqlId);
assert.equal(pgsqlProperties.providerId, pgsqlId);
assert.strictEqual(mssqlProperties.providerId, mssqlId);
assert.strictEqual(pgsqlProperties.providerId, pgsqlId);
});
test('doChangeLanguageFlavor should throw on unknown provider', () => {
@@ -1404,9 +1404,9 @@ suite('SQL ConnectionManagementService tests', () => {
let called = false;
connectionManagementService.onLanguageFlavorChanged((changeParams: azdata.DidChangeLanguageFlavorParams) => {
called = true;
assert.equal(changeParams.uri, uri);
assert.equal(changeParams.language, language);
assert.equal(changeParams.flavor, flavor);
assert.strictEqual(changeParams.uri, uri);
assert.strictEqual(changeParams.language, language);
assert.strictEqual(changeParams.flavor, flavor);
});
connectionManagementService.doChangeLanguageFlavor(uri, language, flavor);
assert.ok(called, 'expected onLanguageFlavorChanged event to be sent');
@@ -1416,17 +1416,17 @@ suite('SQL ConnectionManagementService tests', () => {
test('getUniqueConnectionProvidersByNameMap should return non CMS providers', () => {
let nameToDisplayNameMap: { [providerDisplayName: string]: string } = { 'MSSQL': 'SQL Server', 'MSSQL-CMS': 'SQL Server' };
let providerNames = Object.keys(connectionManagementService.getUniqueConnectionProvidersByNameMap(nameToDisplayNameMap));
assert.equal(providerNames.length, 1);
assert.equal(providerNames[0], 'MSSQL');
assert.strictEqual(providerNames.length, 1);
assert.strictEqual(providerNames[0], 'MSSQL');
});
test('providerNameToDisplayNameMap should return all providers', () => {
let expectedNames = ['MSSQL', 'PGSQL', 'FAKE'];
let providerNames = Object.keys(connectionManagementService.providerNameToDisplayNameMap);
assert.equal(providerNames.length, 3);
assert.equal(providerNames[0], expectedNames[0]);
assert.equal(providerNames[1], expectedNames[1]);
assert.equal(providerNames[2], expectedNames[2]);
assert.strictEqual(providerNames.length, 3);
assert.strictEqual(providerNames[0], expectedNames[0]);
assert.strictEqual(providerNames[1], expectedNames[1]);
assert.strictEqual(providerNames[2], expectedNames[2]);
});
test('ensureDefaultLanguageFlavor should send event if uri is not connected', () => {
@@ -1455,7 +1455,7 @@ suite('SQL ConnectionManagementService tests', () => {
await connect(uri, options);
called = false; //onLanguageFlavorChanged is called when connecting, must set back to false.
connectionManagementService.ensureDefaultLanguageFlavor(uri);
assert.equal(called, false, 'do not expect flavor change to be called');
assert.strictEqual(called, false, 'do not expect flavor change to be called');
});
test('getConnectionId returns the URI associated with a connection that has had its database filled in', async () => {
@@ -1475,8 +1475,8 @@ suite('SQL ConnectionManagementService tests', () => {
// Then the retrieved URIs should match the one on the connection
let expectedUri = Utils.generateUri(connectionProfileWithoutDb);
assert.equal(actualUriWithDb, expectedUri);
assert.equal(actualUriWithoutDb, expectedUri);
assert.strictEqual(actualUriWithDb, expectedUri);
assert.strictEqual(actualUriWithoutDb, expectedUri);
});
test('list and change database tests', async () => {
@@ -1508,11 +1508,11 @@ suite('SQL ConnectionManagementService tests', () => {
mssqlConnectionProvider.setup(x => x.changeDatabase(ownerUri, newDbName)).returns(() => changeDatabasesThenable(ownerUri, newDbName));
await connect(ownerUri, undefined, false, connectionProfileWithoutDb);
let listDatabasesResult = await connectionManagementService.listDatabases(ownerUri);
assert.equal(listDatabasesResult.databaseNames.length, 1);
assert.equal(listDatabasesResult.databaseNames[0], dbName);
assert.strictEqual(listDatabasesResult.databaseNames.length, 1);
assert.strictEqual(listDatabasesResult.databaseNames[0], dbName);
let changeDatabaseResults = await connectionManagementService.changeDatabase(ownerUri, newDbName);
assert(changeDatabaseResults);
assert.equal(newDbName, connectionManagementService.getConnectionProfile(ownerUri).databaseName);
assert.strictEqual(newDbName, connectionManagementService.getConnectionProfile(ownerUri).databaseName);
});
test('list and change database tests for invalid uris', async () => {
@@ -1527,7 +1527,7 @@ suite('SQL ConnectionManagementService tests', () => {
test('getTabColorForUri returns undefined when there is no connection for the given URI', () => {
let connectionManagementService = createConnectionManagementService();
let color = connectionManagementService.getTabColorForUri('invalidUri');
assert.equal(color, undefined);
assert.strictEqual(color, undefined);
});
test('getTabColorForUri returns the group color corresponding to the connection for a URI', async () => {
@@ -1540,7 +1540,7 @@ suite('SQL ConnectionManagementService tests', () => {
let uri = 'testUri';
await connect(uri);
let tabColor = connectionManagementService.getTabColorForUri(uri);
assert.equal(tabColor, expectedColor);
assert.strictEqual(tabColor, expectedColor);
});
test('getConnectionCredentials returns the credentials dictionary for an active connection profile', async () => {
@@ -1550,7 +1550,7 @@ suite('SQL ConnectionManagementService tests', () => {
connectionStatusManager.addConnection(profile, 'test_uri');
(connectionManagementService as any)._connectionStatusManager = connectionStatusManager;
let credentials = await connectionManagementService.getConnectionCredentials(profile.id);
assert.equal(credentials['password'], profile.options['password']);
assert.strictEqual(credentials['password'], profile.options['password']);
});
test('getConnectionCredentials returns the credentials dictionary for a recently used connection profile', async () => {
@@ -1569,13 +1569,13 @@ suite('SQL ConnectionManagementService tests', () => {
testInstantiationService.stub(IStorageService, new TestStorageService());
testInstantiationService.stubCreateInstance(ConnectionStore, connectionStoreMock.object);
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, undefined, undefined, undefined, undefined, getBasicExtensionService());
assert.equal(profile.password, '', 'Profile should not have password initially');
assert.equal(profile.options['password'], '', 'Profile options should not have password initially');
assert.strictEqual(profile.password, '', 'Profile should not have password initially');
assert.strictEqual(profile.options['password'], '', 'Profile options should not have password initially');
// Check for invalid profile id
let badCredentials = await connectionManagementService.getConnectionCredentials(badString);
assert.equal(badCredentials, undefined);
assert.strictEqual(badCredentials, undefined);
let credentials = await connectionManagementService.getConnectionCredentials(profile.id);
assert.equal(credentials['password'], test_password);
assert.strictEqual(credentials['password'], test_password);
});
test('getConnectionCredentials returns the credentials dictionary for a saved connection profile', async () => {
@@ -1599,10 +1599,10 @@ suite('SQL ConnectionManagementService tests', () => {
testInstantiationService.stubCreateInstance(ConnectionStore, connectionStoreMock.object);
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, undefined, undefined, undefined, undefined, getBasicExtensionService());
assert.equal(profile.password, '', 'Profile should not have password initially');
assert.equal(profile.options['password'], '', 'Profile options should not have password initially');
assert.strictEqual(profile.password, '', 'Profile should not have password initially');
assert.strictEqual(profile.options['password'], '', 'Profile options should not have password initially');
let credentials = await connectionManagementService.getConnectionCredentials(profile.id);
assert.equal(credentials['password'], test_password);
assert.strictEqual(credentials['password'], test_password);
});
test('getConnectionUriFromId returns a URI of an active connection with the given id', () => {
@@ -1617,11 +1617,11 @@ suite('SQL ConnectionManagementService tests', () => {
let foundUri = connectionManagementService.getConnectionUriFromId(profile.id);
// Then the returned URI matches the connection's original URI
assert.equal(foundUri, uri);
assert.strictEqual(foundUri, uri);
});
test('provider is registered and working', () => {
assert.equal(connectionManagementService.providerRegistered('MSSQL'), true);
assert.strictEqual(connectionManagementService.providerRegistered('MSSQL'), true);
});
test('getConectionUriFromId returns undefined if the given connection is not active', () => {
@@ -1635,7 +1635,7 @@ suite('SQL ConnectionManagementService tests', () => {
let foundUri = connectionManagementService.getConnectionUriFromId('different_id');
// Then undefined is returned
assert.equal(foundUri, undefined);
assert.strictEqual(foundUri, undefined);
});
test('addSavedPassword fills in Azure access tokens for Azure accounts', async () => {
@@ -1689,8 +1689,8 @@ suite('SQL ConnectionManagementService tests', () => {
let profileWithCredentials = await connectionManagementService.addSavedPassword(azureConnectionProfile);
// Then the returned profile has the account token set
assert.equal(profileWithCredentials.userName, azureConnectionProfile.userName);
assert.equal(profileWithCredentials.options['azureAccountToken'], testToken);
assert.strictEqual(profileWithCredentials.userName, azureConnectionProfile.userName);
assert.strictEqual(profileWithCredentials.options['azureAccountToken'], testToken);
});
test('addSavedPassword fills in Azure access token for selected tenant', async () => {
@@ -1743,8 +1743,8 @@ suite('SQL ConnectionManagementService tests', () => {
let profileWithCredentials = await connectionManagementService.addSavedPassword(azureConnectionProfile);
// Then the returned profile has the account token set corresponding to the requested tenant
assert.equal(profileWithCredentials.userName, azureConnectionProfile.userName);
assert.equal(profileWithCredentials.options['azureAccountToken'], returnedToken.token);
assert.strictEqual(profileWithCredentials.userName, azureConnectionProfile.userName);
assert.strictEqual(profileWithCredentials.options['azureAccountToken'], returnedToken.token);
});
test('getConnections test', () => {
@@ -1776,8 +1776,8 @@ suite('SQL ConnectionManagementService tests', () => {
// dupe connections have been seeded the numbers below already reflected the de-duped results
const verifyConnections = (actualConnections: ConnectionProfile[], expectedConnectionIds: string[], scenario: string) => {
assert.equal(actualConnections.length, expectedConnectionIds.length, 'incorrect number of connections returned, ' + scenario);
assert.deepEqual(actualConnections.map(conn => conn.id).sort(), expectedConnectionIds.sort(), 'connections do not match expectation, ' + scenario);
assert.strictEqual(actualConnections.length, expectedConnectionIds.length, 'incorrect number of connections returned, ' + scenario);
assert.deepStrictEqual(actualConnections.map(conn => conn.id).sort(), expectedConnectionIds.sort(), 'connections do not match expectation, ' + scenario);
};
// no parameter - default to false