diff options
| author | historia <[not public]> | 2026-09-15 20:14:02 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-15 20:14:02 -0400 |
| commit | 69235cac5b3da5ff0dc20310e7474cabd8e63ba3 (patch) | |
| tree | ce96c9506531e219c157f29ac6a6dc53de1df15b /internal/game/admin_owner_test.go | |
| parent | 6f3c43aca62a7d33a19f14f6ad7c16891952673a (diff) | |
| download | thehouseoficarus-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.go | 27 |
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") + } +} |
