|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information.
|
4 | 4 | *--------------------------------------------------------------------------------------------*/
|
5 | 5 |
|
| 6 | +import * as Extension from "../../src/extension"; |
6 | 7 | import * as assert from "assert";
|
7 |
| -import * as vscode from "vscode"; |
8 | 8 |
|
9 |
| -import * as Extension from "../../src/extension"; |
10 | 9 | import ConnectionManager from "../../src/controllers/connectionManager";
|
11 | 10 | import MainController from "../../src/controllers/mainController";
|
12 |
| - |
13 |
| -function ensureExtensionIsActive(): Promise<any> { |
14 |
| - return new Promise((resolve, reject) => { |
15 |
| - waitForExtensionToBeActive(resolve); |
16 |
| - }); |
17 |
| -} |
18 |
| - |
19 |
| -function waitForExtensionToBeActive(resolve): void { |
20 |
| - if ( |
21 |
| - typeof vscode.extensions.getExtension("ms-mssql.mssql") === |
22 |
| - "undefined" || |
23 |
| - !vscode.extensions.getExtension("ms-mssql.mssql").isActive |
24 |
| - ) { |
25 |
| - // tslint:disable-next-line no-invalid-this Bind to the mocha context so it resolves properly |
26 |
| - setTimeout(waitForExtensionToBeActive.bind(this, resolve), 50); |
27 |
| - } else { |
28 |
| - resolve(); |
29 |
| - } |
30 |
| -} |
| 11 | +import { activateExtension } from "./utils"; |
31 | 12 |
|
32 | 13 | suite("Initialization Tests", () => {
|
33 |
| - test("Connection manager is initialized properly", (done) => { |
34 |
| - // Wait for the extension to activate |
35 |
| - void ensureExtensionIsActive().then(async () => { |
36 |
| - // Verify that the connection manager was initialized properly |
37 |
| - let controller: MainController = await Extension.getController(); |
38 |
| - let connectionManager: ConnectionManager = |
39 |
| - controller.connectionManager; |
40 |
| - assert.notStrictEqual(undefined, connectionManager.client); |
41 |
| - done(); |
42 |
| - }); |
| 14 | + test("Connection manager is initialized properly", async () => { |
| 15 | + await activateExtension(); |
| 16 | + let controller: MainController = await Extension.getController(); |
| 17 | + let connectionManager: ConnectionManager = controller.connectionManager; |
| 18 | + assert.notStrictEqual(undefined, connectionManager.client); |
43 | 19 | });
|
44 | 20 | });
|
0 commit comments