test happy shuffle

This commit is contained in:
Bel LaPointe
2023-03-27 08:20:50 -06:00
parent dd41028aab
commit 213fd555e4
2 changed files with 38 additions and 6 deletions

View File

@@ -192,18 +192,50 @@ func TestServeGM(t *testing.T) {
}
})
t.Run("publicStatus", func(t *testing.T) {
t.Run("fillNonPlayerAliases", func(t *testing.T) {
t.Error("not impl")
})
t.Run("publicStatus", func(t *testing.T) {
t.Run("vote", func(t *testing.T) {
t.Error("not impl")
})
t.Run("publicStatus", func(t *testing.T) {
t.Run("elect", func(t *testing.T) {
t.Error("not impl")
})
t.Run("publicStatus", func(t *testing.T) {
t.Run("shuffle", func(t *testing.T) {
t.Run("happy", func(t *testing.T) {
v01 := NewV01(ctx, nil)
v01.cfg.Quiet = true
v01.cfg.Users = map[string]configUser{
"bel": configUser{Player: 1},
"zach": configUser{Player: 2},
}
resp := do(v01, "/gm/rpc/swap?a=bel&b=zach", "")
if resp.Code != http.StatusOK {
t.Error(resp.Code)
}
if v01.cfg.Quiet {
t.Error(v01.cfg.Quiet)
}
if v01.cfg.Users["bel"].Player != 2 {
t.Error(v01.cfg.Users["bel"])
} else if v01.cfg.Users["zach"].Player != 1 {
t.Error(v01.cfg.Users["zach"])
}
})
})
t.Run("publicStatus", func(t *testing.T) {
t.Run("swap", func(t *testing.T) {
t.Error("not impl")
})
t.Run("404", func(t *testing.T) {
v01 := NewV01(ctx, nil)
resp := do(v01, "/gm/teehee", "")
if resp.Code != http.StatusNotFound {
t.Error(resp.Code)
}
})
}