Add missing ruleset params to request body and --debug-requests option (#55)
* fix sending of new params * add royale and squad settings to requests * add --debug-requests option * update test for request body and add helper Co-authored-by: Penelope Phippen <penelope@hey.com>
This commit is contained in:
parent
0cba5eff59
commit
31faba642c
5 changed files with 179 additions and 10 deletions
|
|
@ -4,7 +4,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/BattlesnakeOfficial/rules"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGetIndividualBoardStateForSnake(t *testing.T) {
|
||||
|
|
@ -18,6 +17,5 @@ func TestGetIndividualBoardStateForSnake(t *testing.T) {
|
|||
snake := Battlesnake{Name: "one", URL: "", ID: "one"}
|
||||
requestBody := getIndividualBoardStateForSnake(state, snake, &rules.StandardRuleset{})
|
||||
|
||||
expected := "{\"game\":{\"id\":\"\",\"timeout\":500,\"ruleset\":{\"name\":\"standard\",\"version\":\"cli\"}},\"turn\":0,\"board\":{\"height\":11,\"width\":11,\"food\":[],\"hazards\":[],\"snakes\":[{\"id\":\"one\",\"name\":\"\",\"health\":0,\"body\":[{\"x\":3,\"y\":3}],\"latency\":\"0\",\"head\":{\"x\":3,\"y\":3},\"length\":1,\"shout\":\"\",\"squad\":\"\"},{\"id\":\"two\",\"name\":\"\",\"health\":0,\"body\":[{\"x\":4,\"y\":3}],\"latency\":\"0\",\"head\":{\"x\":4,\"y\":3},\"length\":1,\"shout\":\"\",\"squad\":\"\"}]},\"you\":{\"id\":\"one\",\"name\":\"\",\"health\":0,\"body\":[{\"x\":3,\"y\":3}],\"latency\":\"0\",\"head\":{\"x\":3,\"y\":3},\"length\":1,\"shout\":\"\",\"squad\":\"\"}}"
|
||||
require.Equal(t, expected, string(requestBody))
|
||||
rules.RequireJSONMatchesFixture(t, "testdata/snake_request_body.json", string(requestBody))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue