Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions arena/state/voting.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,8 @@ def reset_vote(round_state: dict[str, Any] | None):
"second_choice": None,
"third_choice": None,
"vote_stage": "pick_first",
"log_warning": None,
"submission_status": None,
"submission_message": None,
}
return updated_state, *_vote_ui_updates(updated_state)
24 changes: 24 additions & 0 deletions tests/unit/state/test_voting.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,27 @@ def test_reset_vote_clears_rankings_for_active_round() -> None:
assert updated_state["second_choice"] is None
assert updated_state["third_choice"] is None
assert updated_state["vote_stage"] == "pick_first"


def test_reset_vote_clears_failed_submission_status_banner() -> None:
state = {
"round_id": "round-1",
"ready_for_vote": True,
"submitted": False,
"first_choice": "Response A",
"second_choice": "Response B",
"third_choice": "Response C",
"vote_stage": "ready_submit",
"log_warning": "disk full",
"submission_status": "error",
"submission_message": "Vote could not be saved: disk full",
}

updated_state, *updates = reset_vote(state)
status_update = updates[-1]

assert updated_state["log_warning"] is None
assert updated_state["submission_status"] is None
assert updated_state["submission_message"] is None
assert status_update.visible is False
assert status_update.value == ""
Loading