Fix for database name in connection details after changing database (#22376)

This commit is contained in:
Alex Ma
2023-05-18 14:34:54 -07:00
committed by GitHub
parent 7d0a7a6721
commit 89386c9c11
14 changed files with 76 additions and 36 deletions

View File

@@ -244,13 +244,16 @@ suite('SQL ConnectionStatusManager tests', () => {
newConnection.id = 'test_id';
newConnection.serverName = 'new_server_name';
newConnection.options['databaseDisplayName'] = newConnection.databaseName;
connections.addConnection(newConnection, 'test_uri_1');
connections.addConnection(newConnection, 'test_uri_2');
//Duplicate should not be registered if uri is of connection/dashboard type (required for functionality)
connections.addConnection(newConnection, 'connection:test_uri_1');
connections.addConnection(newConnection, 'dashboard:test_uri_1');
//Editor type URIs should generate a new profile id (needed to properly update the connection string)
connections.addConnection(newConnection, 'untitled:TestQuery1')
newConnection = new ConnectionProfile(capabilitiesService, newConnection);
// Get the connections and verify that the duplicate is only returned once
// Get the connections and verify that the non editor duplicate is only returned once
let activeConnections = connections.getActiveConnectionProfiles();
assert.strictEqual(activeConnections.length, 4);
assert.strictEqual(activeConnections.filter(connection => connection.matches(newConnection)).length, 1, 'Did not find newConnection in active connections');
assert.strictEqual(activeConnections.length, 5);
assert.strictEqual(activeConnections.filter(connection => connection.matches(newConnection)).length, 2, 'Did not find newConnection in active connections');
});
});