]> git.cworth.org Git - lmno-server/commitdiff
Add failing test for list of judging players when judging phase begins
authorCarl Worth <cworth@cworth.org>
Sat, 27 Jun 2020 14:39:53 +0000 (07:39 -0700)
committerCarl Worth <cworth@cworth.org>
Sat, 27 Jun 2020 14:40:43 +0000 (07:40 -0700)
In the answering phase, the list of answering players (the ones we are
waiting for) initially starts out as empty and then gets populated
only as people start typing (that is, submit a post to the
"/answering" endpoint).

That's appropriate since we don't know who among the players
registered are really actively "playing".

But that's not the right logic for the judging phase. The judging
phase starts immediately after the answering phase has completed, so
at that point we know the precise list of active players and we should
display all of them in the "waiting" list until each has submitted.

This commit adds a failing test case demonstrating that this list is
empty when the judging phase starts, but it should include the names
of each player that submitted an answer, (but not the name of a player
that is registered but did not submit).

test

diff --git a/test b/test
index 45dbbe32fbdfc943e445d77b387b279b4c0de252..703f005cfce3ec707f237b5df74321214eae8c25 100755 (executable)
--- a/test
+++ b/test
@@ -742,6 +742,18 @@ result=$(echo $(empathy_ambiguities alice))
 test "$result" != "null"
 TEST_END
 
+# Usage: empathy_players_judging <player_name>
+empathy_players_judging()
+{
+    empathy_get_event $1 game-state | jq .players_judging[]
+}
+
+TEST "Verify active players listed as judging"
+# echo here is to strip newlines
+result=$(echo $(empathy_players_judging alice))
+test "$result" = '"alice" "bob" "charlie"'
+TEST_END
+
 TEST "Submit word groups from majority"
 empathy_judged alice $prompt_id '[]' >/dev/null
 result=$(empathy_judged bob $prompt_id '[]')