broadcast isnt a user

This commit is contained in:
bel
2023-04-01 11:31:03 -06:00
parent 9de8c91544
commit 3c70e42819
5 changed files with 29 additions and 26 deletions

View File

@@ -183,10 +183,8 @@ func TestServeGM(t *testing.T) {
},
Message: "if someone else says 'driver', then you get to play",
}},
"broadcast": configUser{State: configUserState{
Message: ":)",
}},
}
v01.cfg.Broadcast.Message = ":)"
do(v01, "/gm/rpc/broadcastSomeoneSaidAlias", "")
if !v01.cfg.Quiet {
t.Error(v01.cfg.Quiet)
@@ -196,7 +194,7 @@ func TestServeGM(t *testing.T) {
} else if v.State.GM.LastAlias != "driver" {
t.Error(v.State.GM.LastAlias)
}
if bc := v01.cfg.Users["broadcast"]; bc.State.Message == ":)" {
if bc := v01.cfg.Broadcast.Message; bc == ":)" {
t.Error(bc)
}
})
@@ -342,8 +340,8 @@ func TestServeGM(t *testing.T) {
} else if v01.cfg.Users["zach"].State.Player != 1 {
t.Error(v01.cfg.Users["zach"].State.Player)
}
if v01.cfg.Users["broadcast"].State.Message != `bel is now player 0 and zach is now player 1` {
t.Error(v01.cfg.Users["broadcast"].State.Message)
if v01.cfg.Broadcast.Message != `bel is now player 0 and zach is now player 1` {
t.Error(v01.cfg.Broadcast)
}
})
@@ -367,8 +365,8 @@ func TestServeGM(t *testing.T) {
} else if result["zach"] != 1 {
t.Error(result)
}
if !strings.HasSuffix(v01.cfg.Users["broadcast"].State.Message, `is now player 1`) || strings.Contains(v01.cfg.Users["broadcast"].State.Message, ",") {
t.Error(v01.cfg.Users["broadcast"].State.Message)
if !strings.HasSuffix(v01.cfg.Broadcast.Message, `is now player 1`) || strings.Contains(v01.cfg.Broadcast.Message, ",") {
t.Error(v01.cfg.Broadcast.Message)
}
assignments := map[int]int{}
for _, v := range v01.cfg.Users {
@@ -376,7 +374,7 @@ func TestServeGM(t *testing.T) {
}
if len(assignments) != 2 {
t.Error(assignments)
} else if assignments[0] != 3 {
} else if assignments[0] != 2 {
t.Error(assignments[0])
} else if assignments[1] != 1 {
t.Error(assignments[1])
@@ -402,8 +400,8 @@ func TestServeGM(t *testing.T) {
} else if result["zach"] != 1 {
t.Error(result)
}
if !strings.HasSuffix(v01.cfg.Users["broadcast"].State.Message, `is now player 1`) || strings.Contains(v01.cfg.Users["broadcast"].State.Message, ",") {
t.Error(v01.cfg.Users["broadcast"].State.Message)
if bc := v01.cfg.Broadcast.Message; !strings.HasSuffix(bc, `is now player 1`) || strings.Contains(bc, ",") {
t.Error(bc)
}
assignments := map[int]int{}
for _, v := range v01.cfg.Users {
@@ -411,7 +409,7 @@ func TestServeGM(t *testing.T) {
}
if len(assignments) != 2 {
t.Error(assignments)
} else if assignments[0] != 2 {
} else if assignments[0] != 1 {
t.Error(assignments[0])
} else if assignments[1] != 1 {
t.Error(assignments[1])
@@ -433,7 +431,7 @@ func TestServeGM(t *testing.T) {
if v01.cfg.Quiet {
t.Error(v01.cfg.Quiet)
}
if len(v01.cfg.Users) != 3 {
if len(v01.cfg.Users) != 2 {
t.Error(v01.cfg.Users)
} else if len(v01.cfg.Players) != 2 {
t.Error(v01.cfg.Users)
@@ -482,7 +480,7 @@ func TestServeGM(t *testing.T) {
t.Error(v01.cfg.Quiet)
}
if len(v01.cfg.Users) != c.users+1 {
if len(v01.cfg.Users) != c.users {
t.Error(v01.cfg.Users)
} else if len(v01.cfg.Players) != c.players {
t.Error(v01.cfg.Users)