30 lines
569 B
Go
30 lines
569 B
Go
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
|
|
}
|