From b87f25197b90fa0934bc3ae58b65176e34392563 Mon Sep 17 00:00:00 2001 From: Joaquin Colacci Date: Tue, 7 Nov 2023 14:38:34 +0100 Subject: [PATCH] refactor: return reload status --- src/context/asyncContext.ts | 6 +++--- src/test/suite/extension.test.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/context/asyncContext.ts b/src/context/asyncContext.ts index bea33b7..ebb5beb 100644 --- a/src/context/asyncContext.ts +++ b/src/context/asyncContext.ts @@ -294,8 +294,8 @@ export default class AsyncContext extends Context { this.config.setProfile(name); this.environment = undefined; try { - await this.reloadContext(); - return true; + const success = await this.reloadContext(); + return success; } catch (err) { this.handleErr(err, "Error reloading context."); console.error("[AsyncContext]", "Error reloading context: ", err); @@ -327,7 +327,7 @@ export default class AsyncContext extends Context { * Reloads the whole context. */ private async reloadContext() { - this.isReadyPromise = new Promise((res, rej) => { + this.isReadyPromise = new Promise((res) => { const asyncOp = async () => { try { await this.loadContext(); diff --git a/src/test/suite/extension.test.ts b/src/test/suite/extension.test.ts index ce6cd83..4e7505f 100644 --- a/src/test/suite/extension.test.ts +++ b/src/test/suite/extension.test.ts @@ -253,7 +253,7 @@ suite('Extension Test Suite', () => { const context: AsyncContext = await extension.activate(); const success = await context.setProfile("invalid_profile"); - assert.ok(success === false); + assert.ok(!success); }).timeout(10000); }); \ No newline at end of file