Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

workbenchthis machine

A ban ends the banned person's turn at once and takes them out of the queue #269

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

smith/arm:smith/195-a-ban-ends-the-banned-person-s-turn-at-o → main 1 commit fork

  • Merged. smith/195-a-ban-ends-the-banned-person-s-turn-at-o was merged into main as 3cccc34.

Review

Sign in to review this change.
1 file changed +20 −0
Software/so101/src/lobby.test.ts +20
@@ -612,6 +612,26 @@ describe("lobby", () => {
612612 expect((await enter(port, "another", "203.0.113.66")).status).toBe(200);
613613 });
614614
615 test("ban: the driver's turn ends at once, the next in line drives, and the banned person is out of the queue and refused", async () => {
616 const port = await start();
617 const alice = await join(port, ALICE);
618 const bob = await join(port, BOB);
619 const owner = await join(port, OWNER);
620 alice.send({ type: "join" });
621 await bob.next(drivingIs("alice"));
622 bob.send({ type: "join" });
623 await owner.next((m) => m.type === "state" && m.queue.length === 1);
624
625 owner.send({ type: "ban", id: "u-alice", on: true });
626 const after = await bob.next(drivingIs("bob"));
627 expect(after.queue.some((p: Msg) => p.name === "alice")).toBe(false);
628 expect((await torque(port, ALICE)).status).toBe(403);
629 expect((await alice.first((m) => m.type === "hello" && m.banned)).banned).toBe(true);
630 alice.send({ type: "join" });
631 expect((await alice.next((m) => m.type === "error")).error).toContain("banned");
632 expect(bob.last("state")!.queue.some((p: Msg) => p.name === "alice")).toBe(false);
633 });
634
615635 test("join: at most 3 new names an hour from one address", async () => {
616636 const port = await start();
617637 for (const name of ["one", "two", "three"]) expect((await enter(port, name, "198.51.100.9")).status).toBe(200);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs