Skip to content

Commit

Permalink
refactor: remove unnecessary new Promise wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Oct 9, 2023
1 parent 7cbe593 commit 1ea747c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/binding-coap/test/coap-server-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ class CoapServerTest {
},
});

testThing.setActionHandler("try", (input: WoT.InteractionOutput) => {
return new Promise<string>((resolve, reject) => {
resolve("TEST");
});
testThing.setActionHandler("try", async (input: WoT.InteractionOutput) => {
return "TEST";
});
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand Down Expand Up @@ -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<string>((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
Expand Down

0 comments on commit 1ea747c

Please sign in to comment.