Fix service dependency startup warning (#14180)

* Fix service dependency startup warning

* fix tests
This commit is contained in:
Charles Gagnon
2021-02-06 15:01:16 -08:00
committed by GitHub
parent 63f9be6b5f
commit 86aa24e198
13 changed files with 84 additions and 58 deletions

View File

@@ -50,7 +50,6 @@ export class AccountManagementService implements IAccountManagementService {
// CONSTRUCTOR /////////////////////////////////////////////////////////
constructor(
private _mementoObj: object,
@IInstantiationService private _instantiationService: IInstantiationService,
@IStorageService private _storageService: IStorageService,
@IClipboardService private _clipboardService: IClipboardService,
@@ -58,12 +57,9 @@ export class AccountManagementService implements IAccountManagementService {
@ILogService private readonly _logService: ILogService,
@INotificationService private readonly _notificationService: INotificationService
) {
// Create the account store
if (!this._mementoObj) {
this._mementoContext = new Memento(AccountManagementService.ACCOUNT_MEMENTO, this._storageService);
this._mementoObj = this._mementoContext.getMemento(StorageScope.GLOBAL);
}
this._accountStore = this._instantiationService.createInstance(AccountStore, this._mementoObj);
this._mementoContext = new Memento(AccountManagementService.ACCOUNT_MEMENTO, this._storageService);
const mementoObj = this._mementoContext.getMemento(StorageScope.GLOBAL);
this._accountStore = this._instantiationService.createInstance(AccountStore, mementoObj);
// Setup the event emitters
this._addAccountProviderEmitter = new Emitter<AccountProviderAddedEventParams>();

View File

@@ -214,7 +214,7 @@ suite('Account Management Service Tests:', () => {
// If: I add an account when the provider doesn't exist
// Then: It should not resolve
return Promise.race([
new Promise((resolve, reject) => setTimeout(() => resolve(), 100)),
new Promise<void>((resolve, reject) => setTimeout(() => resolve(), 100)),
ams.addAccount('doesNotExist').then(() => { throw new Error('Promise resolved when the provider did not exist'); })
]);
});
@@ -283,7 +283,7 @@ suite('Account Management Service Tests:', () => {
// If: I get accounts when the provider doesn't exist
// Then: It should not resolve
return Promise.race([
new Promise((resolve, reject) => setTimeout(() => resolve(), 100)),
new Promise<void>((resolve, reject) => setTimeout(() => resolve(), 100)),
ams.getAccountsForProvider('doesNotExist').then(() => { throw new Error('Promise resolved when the provider did not exist'); })
]);
});
@@ -529,13 +529,10 @@ function getTestState(): AccountManagementState {
mockInstantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountStore), TypeMoq.It.isAny()))
.returns(() => mockAccountStore.object);
// Create mock memento
let mockMemento = {};
const testNotificationService = new TestNotificationService();
// Create the account management service
let ams = new AccountManagementService(mockMemento, mockInstantiationService.object, new TestStorageService(), undefined!, undefined!, undefined!, testNotificationService);
let ams = new AccountManagementService(mockInstantiationService.object, new TestStorageService(), undefined!, undefined!, undefined!, testNotificationService);
// Wire up event handlers
let evUpdate = new EventVerifierSingle<UpdateAccountListEventParams>();