From 9e5bf65868eaafcb11d09c0fee02e0d3d7c2121f Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 1 Jun 2020 11:33:36 -0700 Subject: [PATCH] tictactoe: Track API change for the /move request: "square" -> "move" The API was recently changed to be more generic. We track that here by looking for a .move property in the body object, instead of .square. And we conform to that by sending events with data named "move" nota "square" in the corresponding test cases. --- test | 3 +-- tictactoe.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test b/test index 017f38e..0e42462 100755 --- a/test +++ b/test @@ -292,7 +292,7 @@ tictactoe_game_path=tictactoe/$tictactoe_game_id tictactoe_move() { - curl_post $tictactoe_game_path/move "{\"square\": $1}" + curl_post $tictactoe_game_path/move "{ \"move\": $1 }" } TEST_SUBSECTION "Tic Tac Toe /move" @@ -308,4 +308,3 @@ test "$result" = "false" TEST_END TEST_REPORT - diff --git a/tictactoe.js b/tictactoe.js index 89ad5d2..7d7450c 100644 --- a/tictactoe.js +++ b/tictactoe.js @@ -37,7 +37,7 @@ class TicTacToe extends Game { router.post('/move', (request, response) => { const game = request.game; - const square = request.body.square; + const square = request.body.move; const legal = game.add_move(square); -- 2.43.0