Potentially fixes the test percentage (#11974)

* Potentially fixes the test percentage

* PR feedback
This commit is contained in:
Amir Omidi
2020-08-26 14:44:32 -07:00
committed by GitHub
parent 2f94307635
commit 5a301f9073
3 changed files with 8 additions and 6 deletions

View File

@@ -16,7 +16,7 @@ export default abstract class ControllerBase implements vscode.Disposable {
return this._context;
}
abstract activate(): Promise<boolean>;
abstract activate(): Promise<void>;
abstract deactivate(): void;

View File

@@ -29,14 +29,17 @@ export default class MainController extends ControllerBase {
public deactivate(): void {
}
public async activate(): Promise<boolean> {
return new Promise<boolean>(async (resolve) => {
public async activate(): Promise<void> {
const registerFileProviderPromise = new Promise<boolean>(async (resolve) => {
managerInstance.onRegisteredApi<FlatFileProvider>(ApiType.FlatFileProvider)(provider => {
this.initializeFlatFileProvider(provider);
resolve(true);
});
await new ServiceClient(this._outputChannel).startService(this._context);
});
const serviceClient = new ServiceClient(this._outputChannel);
const serviceStartPromise = serviceClient.startService(this._context);
await Promise.all([registerFileProviderPromise, serviceStartPromise]);
}

View File

@@ -5,7 +5,6 @@
import MainController from '../../controllers/mainController';
import { ImportTestUtils, TestExtensionContext } from '../utils.test';
import * as should from 'should';
describe('Main Controller', function () {
let testExtensionContext: TestExtensionContext;
@@ -16,7 +15,7 @@ describe('Main Controller', function () {
it('Extension activates successfully', async function () {
let mainController = new MainController(testExtensionContext);
should.doesNotThrow(() => mainController.activate());
await mainController.activate().should.not.be.rejected();
});
});