diff --git a/packages/binding-http/test/http-client-test.ts b/packages/binding-http/test/http-client-test.ts index 8ca5bc718..e7ad419a0 100644 --- a/packages/binding-http/test/http-client-test.ts +++ b/packages/binding-http/test/http-client-test.ts @@ -104,16 +104,10 @@ class TestHttpServer implements ProtocolServer { } } - public expose(thing: unknown): Promise { - return new Promise((resolve, reject) => { - resolve(); - }); - } + public async expose(thing: unknown): Promise {} - public destroy(thingId: string): Promise { - return new Promise((resolve, reject) => { - resolve(false); - }); + public async destroy(thingId: string): Promise { + return false; } public setTestVector(vector: TestVector) { diff --git a/packages/binding-http/test/http-server-test.ts b/packages/binding-http/test/http-server-test.ts index 586532dd9..9357d111b 100644 --- a/packages/binding-http/test/http-server-test.ts +++ b/packages/binding-http/test/http-server-test.ts @@ -163,10 +163,8 @@ class HttpServerTest { test = await value.value(); }); - testThing.setActionHandler("try", (input: WoT.InteractionOutput) => { - return new Promise((resolve, reject) => { - resolve("TEST"); - }); + testThing.setActionHandler("try", async (input: WoT.InteractionOutput) => { + return "TEST"; }); await httpServer.expose(testThing); @@ -276,11 +274,9 @@ class HttpServerTest { }, }); let test: DataSchemaValue; - testThing.setPropertyReadHandler("test", (options) => { + testThing.setPropertyReadHandler("test", async (options) => { expect(options?.uriVariables).to.deep.equal({ id: "testId" }); - return new Promise((resolve, reject) => { - resolve(test); - }); + return test; }); testThing.setPropertyWriteHandler("test", async (value, options) => { expect(options?.uriVariables).to.deep.equal({ id: "testId" }); @@ -289,11 +285,9 @@ class HttpServerTest { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore testThing.properties.test.forms = []; - testThing.setActionHandler("try", (input: WoT.InteractionOutput, params?: InteractionOptions) => { - return new Promise((resolve, reject) => { - expect(params?.uriVariables).to.deep.equal({ step: 5 }); - resolve("TEST"); - }); + testThing.setActionHandler("try", async (input: WoT.InteractionOutput, params?: InteractionOptions) => { + expect(params?.uriVariables).to.deep.equal({ step: 5 }); + return "TEST"; }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore @@ -339,10 +333,8 @@ class HttpServerTest { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore testThing.properties.test.forms = []; - testThing.setActionHandler("try", (input: WoT.InteractionOutput) => { - return new Promise((resolve, reject) => { - resolve("TEST"); - }); + testThing.setActionHandler("try", async (input: WoT.InteractionOutput) => { + return "TEST"; }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore diff --git a/packages/core/test/ClientTest.ts b/packages/core/test/ClientTest.ts index 0e95ac025..eaad86bcd 100644 --- a/packages/core/test/ClientTest.ts +++ b/packages/core/test/ClientTest.ts @@ -564,7 +564,7 @@ class WoTClientTest { expect(value).to.equal(12); resolve(true); }); - }) + }); } @test async "observe property with formIndex"() { diff --git a/packages/core/test/ServerTest.ts b/packages/core/test/ServerTest.ts index b70a9b9b3..c728d90e7 100644 --- a/packages/core/test/ServerTest.ts +++ b/packages/core/test/ServerTest.ts @@ -43,15 +43,13 @@ chaiUse(spies); class TestProtocolServer implements ProtocolServer { public readonly scheme: string = "test"; - async expose(thing: ExposedThing): Promise { - } + async expose(thing: ExposedThing): Promise {} async destroy(thingId: string): Promise { return true; } - async start(): Promise { - } + async start(): Promise {} async stop(): Promise {}