A couple more state tests

This commit is contained in:
Neale Pickett 2019-12-05 21:50:43 -07:00
parent 97da227777
commit dc35217840
1 changed files with 14 additions and 2 deletions

View File

@ -38,13 +38,25 @@ func TestState(t *testing.T) {
if (len(teamids) != 101) || (len(teamids[100]) > 0) { if (len(teamids) != 101) || (len(teamids[100]) > 0) {
t.Errorf("There weren't 100 teamids, there were %d", len(teamids)) t.Errorf("There weren't 100 teamids, there were %d", len(teamids))
} }
myTeam := string(teamids[0]) teamId := string(teamids[0])
if err := s.SetTeamName("bad team ID", "bad team name"); err == nil { if err := s.SetTeamName("bad team ID", "bad team name"); err == nil {
t.Errorf("Setting bad team ID didn't raise an error") t.Errorf("Setting bad team ID didn't raise an error")
} }
if err := s.SetTeamName(myTeam, "My Team"); err != nil { if err := s.SetTeamName(teamId, "My Team"); err != nil {
t.Errorf("Setting team name: %v", err) t.Errorf("Setting team name: %v", err)
} }
category := "poot"
points := 3928
s.AwardPoints(teamId, category, points)
s.Cleanup()
pl = s.PointsLog()
if len(pl) != 1 {
t.Errorf("After awarding points, points log has length %d", len(pl))
} else if (pl[0].TeamId != teamId) || (pl[0].Category != category) || (pl[0].Points != points) {
t.Errorf("Incorrect logged award %v", pl)
}
} }