]> git.cworth.org Git - empires-server/blobdiff - test
test: Add failing test case for unnecessary delay for end-judging voting
[empires-server] / test
diff --git a/test b/test
index 12da35fa8f7ce2b71ffc7f62a68d730a9d9923b0..45dbbe32fbdfc943e445d77b387b279b4c0de252 100755 (executable)
--- a/test
+++ b/test
@@ -779,6 +779,42 @@ result=$(echo $(empathy_scores alice))
 test "$result" != "null"
 TEST_END
 
+TEST_SUBSECTION "New game (no voting needed when all answered players judge)"
+
+TEST "Start 4-player game, 3 submissions"
+empathy_reset
+prompt_id=$(empathy_submit_prompt alice 4 "1 truth or dare" | jq .id)
+empathy_start alice $prompt_id
+empathy_answer alice   $prompt_id '"truth"' >/dev/null
+empathy_answer bob     $prompt_id '"truth"' >/dev/null
+empathy_answer charlie $prompt_id '"dare"' >/dev/null
+empathy_end_answers alice $prompt_id
+empathy_end_answers bob $prompt_id
+empathy_end_answers charlie $prompt_id
+test "$?" = "0"
+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
+
 pkill -P $alice_pid
 pkill -P $bob_pid
 pkill -P $charlie_pid