Add VoteParty pending preparation regression test

This commit is contained in:
Ben committed 2026-11-14 10:22:59 -06:00
1 parent 23e346c174
commit a2cd253515
1 file changed
+28
@@ -554,4 +554,32 @@ class VotePartyStoredRecipientFailureTest {
assertEquals(reset ? 0 : 8, party.getTotalVotes());
}
@Test
void votesAccumulatedDuringStoredPreparationTriggerNextPartyWithoutAnotherVote() {
when(mysql.getRowsQuery()).thenReturn(new ArrayList<>());
// The first threshold starts asynchronous stored-recipient preparation.
party.check(user, false);
assertEquals(1, storage.size());
// Three more votes arrive while the first party is still preparing.
// Each vote performs the normal threshold check, but those checks are
// suppressed while storedPreparation is active.
for (int i = 0; i < 3; i++) {
party.addTotal(user);
party.check(user, false);
}
assertEquals(6, party.getTotalVotes());
// Completing the first party must retain responsibility for the three
// accumulated votes and start the second party without a seventh vote.
drain();
assertEquals(0, party.getTotalVotes(),
"remaining eligible votes must be rechecked when stored preparation finishes");
verify(serverData, times(2)).updateLastVoteParty();
}
}