]> git.cworth.org Git - lmno-server/commitdiff
tictactoe: Track API change for the /move request: "square" -> "move"
authorCarl Worth <cworth@cworth.org>
Mon, 1 Jun 2020 18:33:36 +0000 (11:33 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 1 Jun 2020 18:33:36 +0000 (11:33 -0700)
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
tictactoe.js

diff --git a/test b/test
index 017f38eda85a0d4930b25f573746a80f850e9a96..0e42462a264d8d8e07063628bf6ff7a951cb4a44 100755 (executable)
--- 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
-
index 89ad5d2b4685224ed4766447cea4eef9f4c437bb..7d7450c5ab6c4504e16aba53e9c011bd02757286 100644 (file)
@@ -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);