From: Carl Worth Date: Sat, 27 Jun 2020 16:11:42 +0000 (-0700) Subject: Add new failing test case: Inactive players shouldn't impede phase advance X-Git-Url: https://git.cworth.org/git?p=lmno-server;a=commitdiff_plain;h=13f2a95476240fd9049008d1a5a5f8711b39c3fd Add new failing test case: Inactive players shouldn't impede phase advance The current implementation is waiting for all registered players to have submitted answers before auto-advance (prior to a majority vote to move on without anyone). That seems like reasonable logic, except for a player that the server has already noticed is no longer active (event stream connection has dropped and server has indicated the player is gone from the game). We don't want such an inactive player impeding the progress of the game. This commit adds a test case capturing the behavior we actually want, (so this test is currently failing). --- diff --git a/test b/test index 48db90d..f5f5eeb 100755 --- 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