create basic controller
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/iliadenisov/galaxy/pkg/repo"
|
||||
"github.com/iliadenisov/galaxy/pkg/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewGame(t *testing.T) {
|
||||
root, cleanup := util.CreateWorkDir(t)
|
||||
defer cleanup()
|
||||
|
||||
r, err := repo.NewFileRepo(root)
|
||||
assert.NoError(t, err)
|
||||
|
||||
players := 20
|
||||
races := make([]string, players)
|
||||
for i := range players {
|
||||
races[i] = fmt.Sprintf("race_%02d", i)
|
||||
}
|
||||
assert.NoError(t, r.Lock())
|
||||
gameID, err := newGame(r, races)
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, r.Release())
|
||||
_ = gameID
|
||||
}
|
||||
Reference in New Issue
Block a user