Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(binding-coap): await all calls of coapServer.stop() #1094

Merged
merged 4 commits into from
Sep 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/binding-coap/test/coap-server-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"() {
Expand All @@ -307,7 +307,7 @@ class CoapServerTest {
'</test1>;rt="wot.thing";ct="50 432",</test2>;rt="wot.thing";ct="50 432"'
);

return coapServer.stop();
await coapServer.stop();
}

@test async "should support TD Content-Format negotiation"() {
Expand Down Expand Up @@ -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) {
Expand All @@ -357,7 +357,7 @@ class CoapServerTest {
}

if (++responseCounter >= contentFormats.length) {
coapServer.stop();
await coapServer.stop();
}
});
req.end();
Expand All @@ -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();
}
Expand Down
Loading