]> git.cworth.org Git - lmno-server/blobdiff - test
Add new failing test case: Inactive players shouldn't impede phase advance
[lmno-server] / test
diff --git a/test b/test
index 48db90d117ca13a295f565984db5dc57c0aed463..f5f5eeb91e9b06869e96fb69438b388bdc40c6b2 100755 (executable)
--- a/test
+++ b/test
@@ -923,4 +923,51 @@ result=$(echo $(empathy_scores_names_numbers alice))
 test "$result" = '"alice" 1 "bob" 1 "charlie" 0'
 TEST_END
 
+TEST_SUBSECTION "Deactivated players don't block future game phase advances"
+
+TEST "New 3-player game, 2 submit right away"
+empathy_reset
+prompt_id=$(empathy_submit_prompt charlie 4 "2 legit 2 quit" | jq .id)
+empathy_start alice $prompt_id
+empathy_answer alice $prompt_id '"what", "gives?"' >/dev/null
+empathy_answer bob   $prompt_id '"so", "confused"' >/dev/null
+test "$?" = "0"
+TEST_END
+
+TEST "Judging hasn't started with player unsubmitted"
+result=$(echo $(empathy_ambiguities alice))
+test "$result" = "null"
+TEST_END
+
+TEST "Final active player submits"
+result=$(empathy_answer charlie $prompt_id '"best", "category"')
+test "$result" = '{"valid":true}'
+TEST_END
+
+TEST "Judging has started (don't need inactive players)"
+result=$(echo $(empathy_ambiguities alice))
+test "$result" != "null"
+TEST_END
+
+TEST "Submit word groups from 2 players"
+empathy_judged alice $prompt_id '[]' >/dev/null
+result=$(empathy_judged bob $prompt_id '[]')
+test "$result" = '{"valid":true}'
+TEST_END
+
+TEST "Scoring hasn't started with player unsubmitted"
+result=$(echo $(empathy_scores alice))
+test "$result" = "null"
+TEST_END
+
+TEST "Submit word groups from last answering player"
+result=$(empathy_judged charlie $prompt_id '[]')
+test "$result" = '{"valid":true}'
+TEST_END
+
+TEST "Scoring has now started"
+result=$(echo $(empathy_scores alice))
+test "$result" != "null"
+TEST_END
+
 cleanup_and_report