aboutsummaryrefslogtreecommitdiff
path: root/internal/game/admin_owner_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-15 20:14:02 -0400
committerhistoria <[not public]>2026-09-15 20:14:02 -0400
commit69235cac5b3da5ff0dc20310e7474cabd8e63ba3 (patch)
treece96c9506531e219c157f29ac6a6dc53de1df15b /internal/game/admin_owner_test.go
parent6f3c43aca62a7d33a19f14f6ad7c16891952673a (diff)
downloadthehouseoficarus-69235cac5b3da5ff0dc20310e7474cabd8e63ba3.tar.gz
feat: route all html editor API mutations through single owner task
Diffstat (limited to 'internal/game/admin_owner_test.go')
-rw-r--r--internal/game/admin_owner_test.go27
1 files changed, 27 insertions, 0 deletions
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")
+ }
+}