From dc352178400e215bee40bce66c3cc43669ca0d54 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 5 Dec 2019 21:50:43 -0700 Subject: [PATCH] A couple more state tests --- cmd/mothd/state_test.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd/mothd/state_test.go b/cmd/mothd/state_test.go index 9efd4c1..668ab7e 100644 --- a/cmd/mothd/state_test.go +++ b/cmd/mothd/state_test.go @@ -38,13 +38,25 @@ func TestState(t *testing.T) { if (len(teamids) != 101) || (len(teamids[100]) > 0) { 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 { 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) } + + 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) + } }