From aba5225ed2299363b9f3586c65f6ccbda33452ae Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Sun, 15 Dec 2024 12:42:53 -0700 Subject: [PATCH] unittest not impls --- cmd/server/usergameserver_test.go | 45 +++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/cmd/server/usergameserver_test.go b/cmd/server/usergameserver_test.go index 3aed585..829f887 100644 --- a/cmd/server/usergameserver_test.go +++ b/cmd/server/usergameserver_test.go @@ -24,7 +24,7 @@ func TestUserGameServer(t *testing.T) { pids = append(pids, pid) } - ugs, err := NewUserGameServer(ctx, Session{ID: "p1"}, games) + ugs, err := NewUserGameServer(ctx, Session{ID: pids[0]}, games) if err != nil { t.Fatal(err) } @@ -45,10 +45,51 @@ func TestUserGameServer(t *testing.T) { for _, pid := range pids { if p, ok := state.Players[pid]; !ok { - t.Error("self not in players") + t.Error(pid, "not in players") } else if !p.Empty() { t.Error(pid, p) } } }) + + if err := games.CreateEventAssignmentRotation(ctx, gid, "", "", "", 0); err != nil { + t.Fatal(err) + } + + t.Run("started but no kills", func(t *testing.T) { + state, err := ugs.State(ctx) + if err != nil { + t.Fatal(err) + } + + if !state.Started { + t.Error("not started after assignment rotation") + } + + if !state.Completed.IsZero() { + t.Error("completed after assignment rotation") + } + + for _, pid := range pids { + if p, ok := state.Players[pid]; !ok { + t.Error(pid, "not in players") + } else if p.Empty() { + t.Error(pid, p) + } + + if isSelf := pid == ugs.Session.ID; isSelf { + t.Error("not impl") + } else { + t.Error("not impl") + } + } + }) + + t.Run("started with kills", func(t *testing.T) { + t.Error("not impl") + }) + + t.Run("completed", func(t *testing.T) { + t.Error("not impl") + }) }