From 63f709ef14ac9f03a75054b5c65c4635920b7e0b Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Thu, 21 Sep 2023 13:15:28 +0200 Subject: [PATCH] =?UTF-8?q?test:=20`await=C2=B4=20all=20calls=20of=20`coap?= =?UTF-8?q?Server.stop()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/binding-coap/test/coap-server-test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/binding-coap/test/coap-server-test.ts b/packages/binding-coap/test/coap-server-test.ts index 294815152..5dcb8a308 100644 --- a/packages/binding-coap/test/coap-server-test.ts +++ b/packages/binding-coap/test/coap-server-test.ts @@ -280,7 +280,7 @@ class CoapServerTest { const resp = await coapClient.readResource(new TD.Form(uri + "properties/test?id=testId&globalVarTest=test1")); expect((await resp.toBuffer()).toString()).to.equal('"testValue"'); - return coapServer.stop(); + await coapServer.stop(); } @test async "should support /.well-known/core"() { @@ -307,7 +307,7 @@ class CoapServerTest { ';rt="wot.thing";ct="50 432",;rt="wot.thing";ct="50 432"' ); - return coapServer.stop(); + await coapServer.stop(); } @test async "should support TD Content-Format negotiation"() { @@ -344,7 +344,7 @@ class CoapServerTest { req.setHeader("Accept", contentFormat); } - req.on("response", (res: IncomingMessage) => { + req.on("response", async (res: IncomingMessage) => { const requestContentFormat = res.headers["Content-Format"]; if (contentFormat === unsupportedContentFormat) { @@ -357,7 +357,7 @@ class CoapServerTest { } if (++responseCounter >= contentFormats.length) { - coapServer.stop(); + await coapServer.stop(); } }); req.end(); @@ -383,9 +383,9 @@ class CoapServerTest { port: coapServer.getPort(), }); req.setOption("Size2", 0); - req.on("response", (res) => { + req.on("response", async (res) => { expect(res.headers.Size2).to.equal(JSON.stringify(testThing.getThingDescription()).length); - coapServer.stop(); + await coapServer.stop(); }); req.end(); }