Fix stupidity

This commit is contained in:
Schluffe
2026-09-17 22:21:02 +02:00
parent 6e867e33b1
commit f062753f8f
2 changed files with 47 additions and 22 deletions
+39 -19
View File
@@ -47,7 +47,7 @@ function flush(): Promise<void> {
}
Deno.test(
"welcome all clients on open",
"Welcome all clients on connect.",
setup(async () => {
const [s1, m1] = await connect(href);
const [s2, m2] = await connect(href);
@@ -62,26 +62,46 @@ Deno.test(
}),
);
// Deno.test(
// "removes a client from broadcast after it disconnects",
// setup(async () => {
// const [s1, m1] = await connect(href);
// const [s2, m2] = await connect(href);
// const [s3, m3] = await connect(href);
Deno.test(
"Messages all clients in a room on joining.",
setup(async () => {
const [s1, m1] = await connect(href);
const [s2, m2] = await connect(href);
// await flush();
await flush();
m1.length = 0;
m2.length = 0;
// m1.length = 0;
// m2.length = 0;
// m3.length = 0;
s1.send("/join meh");
s2.send("/join meh");
await flush();
// await close(s3);
assertEquals(m1, ["1 has joined!", "2 has joined!"]);
assertEquals(m2, ["2 has joined!"]);
// assertEquals(m1, ["3 has left!"]);
// assertEquals(m2, ["3 has left!"]);
// assertEquals(m3, []);
await close(s2);
await close(s1);
}),
);
// await close(s2);
// await close(s1);
// }),
// );
Deno.test(
"Messages remaining members if one left the room.",
setup(async () => {
const [s1, m1] = await connect(href);
const [s2, m2] = await connect(href);
s1.send("/join meh");
s2.send("/join meh");
await flush();
m1.length = 0;
m2.length = 0;
await close(s2);
await flush();
assertEquals(m1, ["2 has left!"]);
assertEquals(m2, []);
await close(s1);
}),
);