Neale Pickett
·
2023-03-23
issues_test.go
1package main
2
3import (
4 "testing"
5
6 "github.com/spf13/afero"
7)
8
9func TestIssue156(t *testing.T) {
10 puzzles := NewTestMothballs()
11 state := NewTestState()
12 theme := NewTestTheme()
13 server := NewMothServer(Configuration{}, theme, state, puzzles)
14
15 afero.WriteFile(state, "teams/bloop", []byte("bloop: the team"), 0644)
16 state.refresh()
17
18 handler := server.NewHandler("bloop")
19 es := handler.ExportState()
20 if _, ok := es.TeamNames["self"]; !ok {
21 t.Fail()
22 }
23
24 err := handler.Register("bloop: the other team")
25 if err != ErrAlreadyRegistered {
26 t.Fail()
27 }
28}