aboutsummaryrefslogtreecommitdiff
path: root/internal/net/server_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/net/server_test.go')
-rw-r--r--internal/net/server_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/net/server_test.go b/internal/net/server_test.go
index da8084a..6a3b376 100644
--- a/internal/net/server_test.go
+++ b/internal/net/server_test.go
@@ -99,6 +99,21 @@ func (c *fakeNetConn) readDeadline() time.Time {
return c.deadline
}
+// TestEnterRoomClearsCasinoWatch: detailed table watch is scoped to the room
+// it was set in, so entering a room stops a stale watch instead of silently
+// resuming it when the player returns.
+func TestEnterRoomClearsCasinoWatch(t *testing.T) {
+ h := NewHub()
+ s := &Session{}
+ h.Add(s)
+ s.CasinoWatchRoom = 7
+ s.CasinoWatchTable = "bj1"
+ h.EnterRoom(s, 9)
+ if s.CasinoWatchRoom != 0 || s.CasinoWatchTable != "" {
+ t.Fatalf("watch survived a room change: room=%d table=%q", s.CasinoWatchRoom, s.CasinoWatchTable)
+ }
+}
+
// TestConnectionCapRefusalKeepsTheServerDrained: at maxConnections a new
// connection is refused without holding a slot (the counter stays at the cap),
// and the refused peer is told why. Once the admitted sessions end, the live