From 4ee3cb798a8f103bb0f209ea1e1e7bb5b8ce3b42 Mon Sep 17 00:00:00 2001 From: Bryan Johnson Date: Sun, 17 Mar 2019 22:44:17 -0400 Subject: [PATCH] Finalize async/await changes --- src/hue-node.spec.ts | 2 +- src/hue-node.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hue-node.spec.ts b/src/hue-node.spec.ts index 50158b0..7dd68cc 100644 --- a/src/hue-node.spec.ts +++ b/src/hue-node.spec.ts @@ -104,7 +104,7 @@ test.serial('init with retrieval', async t => { t.pass(); }); -test.serial.beforeEach(async t => { +test.serial.beforeEach(async _ => { hue = new Hue({ ip: ip, key: key, diff --git a/src/hue-node.ts b/src/hue-node.ts index af59e48..fc0e585 100644 --- a/src/hue-node.ts +++ b/src/hue-node.ts @@ -98,7 +98,7 @@ export class Hue extends HueBridge { * @return {Promise} Promise representing the remote call to the Hue bridge */ private async putJSON(url: string, data: any): Promise { - return this._http.put(url, data); + return await this._http.put(url, data); } /** @@ -109,7 +109,7 @@ export class Hue extends HueBridge { * @return {Promise} Promise representing the remote call to the Hue bridge */ private async get(destination: string): Promise { - return this._http.get(destination); + return await this._http.get(destination); } /** @@ -120,7 +120,7 @@ export class Hue extends HueBridge { */ private async getState(lampIndex: number): Promise> { const url = this.buildLampQueryURL(lampIndex); - return this.get(url); + return await this.get(url); } /** @@ -174,7 +174,7 @@ export class Hue extends HueBridge { * @return {AxiosPromise} Promise representing the remote call to the Hue bridge */ private async put(lampIndex: number, data: any): Promise { - return this.putJSON(this.buildStateURL(lampIndex), data); + return await this.putJSON(this.buildStateURL(lampIndex), data); } /** @@ -188,7 +188,7 @@ export class Hue extends HueBridge { groupIndex: number, action: any ): Promise { - return this.putJSON(this.buildGroupActionURL(groupIndex), action); + return await this.putJSON(this.buildGroupActionURL(groupIndex), action); } /** @@ -240,7 +240,7 @@ export class Hue extends HueBridge { private buildBrightenState( increment?: number ): States.BrightnessIncrementState { - let incrementState = this.buildDimState(increment); + const incrementState = this.buildDimState(increment); incrementState.bri_inc = Math.abs(incrementState.bri_inc); return incrementState; }