From 1ea747c8632aa3cddfdf4eaf15de56563b7d93c1 Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Mon, 9 Oct 2023 17:51:29 +0200 Subject: [PATCH] refactor: remove unnecessary `new Promise` wrappers --- packages/binding-coap/test/coap-server-test.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/binding-coap/test/coap-server-test.ts b/packages/binding-coap/test/coap-server-test.ts index 9dfcf9e36..901c952cb 100644 --- a/packages/binding-coap/test/coap-server-test.ts +++ b/packages/binding-coap/test/coap-server-test.ts @@ -127,10 +127,8 @@ class CoapServerTest { }, }); - 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 @@ -444,11 +442,9 @@ class CoapServerTest { // 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