From b01a5001892809a70c193f37f871022aa9a809ac Mon Sep 17 00:00:00 2001 From: John Donaldson Date: Fri, 21 Oct 2022 15:08:28 -0700 Subject: [PATCH] Add test for deleted teamids.txt --- cmd/mothd/state_filesystem_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cmd/mothd/state_filesystem_test.go b/cmd/mothd/state_filesystem_test.go index 233a72e..c51cf3d 100644 --- a/cmd/mothd/state_filesystem_test.go +++ b/cmd/mothd/state_filesystem_test.go @@ -627,8 +627,23 @@ func TestStateTeamIDs(t *testing.T) { t.Errorf("Expected to find 0 team ID, found %d (%s), instead", len(teamIDs), teamIDs) } } +} - +func TestStateDeleteTeamIDList(t *testing.T) { + s := NewTestState() + s.refresh() + + afero.Remove(s, "teamids.txt") + + teamIDs, err := s.TeamIDs() + + if len(teamIDs) != 0 { + t.Errorf("Expected to find 0 team IDs, found %d (%s), instead", len(teamIDs), teamIDs) + } + + if err == nil { + t.Errorf("Did not receive expected error for non-existent teamids.txt") + } } func TestStateTeamNames(t *testing.T) {