         XCTAssertNotNil(server?[ServerPersistKeys.databaseName], "new server database name isn't nil")
     }
 
+    func testServerIndexForUrl() {
+        DatabaseManager.setupTestServers()
+        XCTAssertEqual(DatabaseManager.serverIndexForUrl("wss://foo.com/websocket"), 0, "correct index for foo.com")
+        XCTAssertEqual(DatabaseManager.serverIndexForUrl("wss://open.rocket.chat/websocket"), 1, "correct index for open.rocket.chat")
+        XCTAssertNil(DatabaseManager.serverIndexForUrl("wss://unexisting.chat/websocket"), "index is nil for unexisting server")
+    }
 }


import XCTest
@testable import Rocket_Chat

class DatabaseManagerSpec: XCTestCase {


    }

    func testServersList() {
        DatabaseManager.setupTestServers()
        XCTAssertEqual(DatabaseManager.servers?.count, 2, "2 servers into the list")
    }

    func testSelectDatabase() {
