Byte-snake-engine/client/models_test.go
Rob O'Dwyer 82e1999126
DEV-1761: New rules API (#118)
* DEV-1761: Clean up Ruleset interface (#115)

* remove legacy ruleset types and simplify ruleset interface

* remove unnecessary settings argument from Ruleset interface

* decouple rules.Settings from client API and store settings as strings

* DEV 1761: Add new BoardState and Point fields (#117)

* add Point.TTL, Point.Value, GameState and PointState to BoardState

* allow maps to access BoardState.GameState,PointState

* add PreUpdateBoard and refactor snail_mode with it

* fix bug where an extra turn was printed to the console

* fix formatting

* fix lint errors

Co-authored-by: JonathanArns <jonathan.arns@googlemail.com>
2022-10-28 16:49:49 -07:00

26 lines
743 B
Go

package client
import (
"encoding/json"
"testing"
"github.com/BattlesnakeOfficial/rules/test"
"github.com/stretchr/testify/require"
)
func TestBuildSnakeRequestJSON(t *testing.T) {
snakeRequest := exampleSnakeRequest()
data, err := json.MarshalIndent(snakeRequest, "", " ")
require.NoError(t, err)
test.RequireJSONMatchesFixture(t, "testdata/snake_request.json", string(data))
}
func TestBuildSnakeRequestJSONEmptyRulesetSettings(t *testing.T) {
snakeRequest := exampleSnakeRequest()
snakeRequest.Game.Ruleset.Settings = RulesetSettings{}
data, err := json.MarshalIndent(snakeRequest, "", " ")
require.NoError(t, err)
test.RequireJSONMatchesFixture(t, "testdata/snake_request_empty_ruleset_settings.json", string(data))
}