Skip to content

Commit

Permalink
test: adapter.close() is now called by io.close()
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Mar 14, 2024
1 parent 96dfc4a commit f97cd2a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 32 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions test/connection-state-recovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ describe("connection state recovery", () => {
});

afterEach(async () => {
servers.forEach((server) => {
// @ts-ignore
server.httpServer.close();
server.of("/").adapter.close();
server.of("/foo").adapter.close();
});
servers.forEach((server) => server.close());
await mongoClient.close();
});

Expand Down Expand Up @@ -267,12 +262,7 @@ describe("connection state recovery", () => {
});

afterEach(async () => {
servers.forEach((server) => {
// @ts-ignore
server.httpServer.close();
server.of("/").adapter.close();
server.of("/foo").adapter.close();
});
servers.forEach((server) => server.close());
await mongoClient.close();
});

Expand Down
15 changes: 3 additions & 12 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,8 @@ describe("@socket.io/mongodb-adapter", () => {
});

afterEach(async () => {
servers.forEach((server) => {
// @ts-ignore
server.httpServer.close();
server.of("/").adapter.close();
});
clientSockets.forEach((socket) => {
socket.disconnect();
});
servers.forEach((server) => server.close());
clientSockets.forEach((socket) => socket.disconnect());
await mongoClient.close();
});

Expand All @@ -85,10 +79,7 @@ describe("@socket.io/mongodb-adapter", () => {
});

it("broadcasts to all clients in a namespace", (done) => {
const partialDone = times(3, () => {
servers.forEach((server) => server.of("/custom").adapter.close());
done();
});
const partialDone = times(3, done);

servers.forEach((server) => server.of("/custom"));

Expand Down

0 comments on commit f97cd2a

Please sign in to comment.