unittest not impls
parent
f3f70e10f4
commit
aba5225ed2
|
|
@ -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")
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue