Byte-snake-engine/client/models_test.go
Rob O'Dwyer 4a9dbbcaef
DEV 559: Refactor CLI and add customizations (#57)
* move snake API structs into a new client package

* add customizations to snake objects

* refactor and add support for passing snake customizations in games
2021-11-25 14:07:56 -08: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))
}