create basic controller

This commit is contained in:
Ilia Denisov
2025-09-26 20:54:34 +03:00
parent 282150a253
commit 66eeefc65d
13 changed files with 357 additions and 165 deletions
+25
View File
@@ -0,0 +1,25 @@
package game_test
import (
"fmt"
"testing"
"github.com/iliadenisov/galaxy/pkg/game"
"github.com/iliadenisov/galaxy/pkg/util"
"github.com/stretchr/testify/assert"
)
func TestComposeGame(t *testing.T) {
root, cleanup := util.CreateWorkDir(t)
defer cleanup()
players := 20
races := make([]string, players)
for i := range players {
races[i] = fmt.Sprintf("race_%02d", i)
}
_, err := game.ComposeGame(func(p *game.Param) { p.StoragePath = root }, races)
assert.NoError(t, err)
_, err = game.ComposeGame(func(p *game.Param) { p.StoragePath = root }, races)
assert.Error(t, err)
assert.ErrorContains(t, err, "state for turn 0 already saved")
}