From 69235cac5b3da5ff0dc20310e7474cabd8e63ba3 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 15 Sep 2026 20:14:02 -0400 Subject: feat: route all html editor API mutations through single owner task --- internal/game/admin_owner_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 internal/game/admin_owner_test.go (limited to 'internal/game/admin_owner_test.go') diff --git a/internal/game/admin_owner_test.go b/internal/game/admin_owner_test.go new file mode 100644 index 0000000..e592660 --- /dev/null +++ b/internal/game/admin_owner_test.go @@ -0,0 +1,27 @@ +package game + +import "testing" + +func TestRunAdminOnOwnerRejectsShutdown(t *testing.T) { + g := &Game{owner: newOwner()} + defer g.stopOwner() + if !g.RunAdminOnOwner(func() {}) { + t.Fatal("running owner rejected task") + } + g.setShuttingDown() + if g.RunAdminOnOwner(func() { t.Error("task ran during shutdown") }) { + t.Error("shutdown accepted task") + } + g.stopOwner() + if g.RunAdminOnOwner(func() { t.Error("task ran after owner stopped") }) { + t.Error("stopped owner accepted task") + } +} + +func TestRunAdminOnOwnerNeverFallsBackInline(t *testing.T) { + g := &Game{owner: newOwner()} + g.stopOwner() + if g.RunAdminOnOwner(func() { t.Error("task ran inline after stop") }) { + t.Error("stopped owner accepted task") + } +} -- cgit v1.2.3