Add test for /spawn

Required small refactor
This commit is contained in:
Marc Di Luzio 2020-06-02 17:59:33 +01:00
parent 68d117e0d8
commit b152861222
6 changed files with 43 additions and 14 deletions
pkg/server

View file

@ -6,7 +6,6 @@ import (
"net/http"
"github.com/google/uuid"
"github.com/mdiluz/rove/pkg/accounts"
"github.com/mdiluz/rove/pkg/game"
"github.com/mdiluz/rove/pkg/version"
)
@ -125,8 +124,7 @@ func (s *Server) HandleRegister(w http.ResponseWriter, r *http.Request) {
fmt.Printf("\tdata: %+v\n", data)
// Register the account with the server
acc := accounts.Account{Name: data.Name}
acc, err := s.accountant.RegisterAccount(acc)
acc, err := s.accountant.RegisterAccount(data.Name)
// If we didn't fail, respond with the account ID string
if err == nil {