mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-14 04:12:03 +00:00
fix(multiplayer): preserve proposal requeues
This commit is contained in:
@@ -96,15 +96,22 @@ func test_proposal_terminal_states_are_visible_and_not_cancellable() -> void:
|
||||
assert_true(state.apply_proposal_update({"proposal_id": "proposal-1", "revision": 1, "state": "OPEN"}), "open proposal applies")
|
||||
assert_eq(state.phase, MatchmakingState.PROPOSED, "open proposal is visible")
|
||||
assert_true(state.apply_proposal_update({"proposal_id": "proposal-1", "revision": 2, "state": "DECLINED"}), "declined proposal applies")
|
||||
assert_eq(state.phase, MatchmakingState.FAILED, "decline is terminal and visible")
|
||||
assert_true(not state.can_cancel(), "terminal proposal cannot issue queue cancel")
|
||||
assert_eq(state.phase, MatchmakingState.QUEUED, "decline returns the requeued ticket to search")
|
||||
assert_true(state.can_cancel(), "requeued ticket can be cancelled")
|
||||
|
||||
var expired := MatchmakingState.new()
|
||||
expired.begin_queue("ticket-2", "casual")
|
||||
assert_true(expired.apply_proposal_update({"proposal_id": "proposal-2", "revision": 1, "state": "OPEN"}), "second proposal opens")
|
||||
assert_true(expired.apply_proposal_update({"proposal_id": "proposal-2", "revision": 2, "state": "EXPIRED"}), "expired proposal applies")
|
||||
assert_eq(expired.phase, MatchmakingState.EXPIRED, "expiry is visible")
|
||||
assert_true(not expired.can_cancel(), "expired proposal cannot be cancelled")
|
||||
assert_eq(expired.phase, MatchmakingState.QUEUED, "expiry returns the requeued ticket to search")
|
||||
assert_true(expired.can_cancel(), "requeued ticket can be cancelled")
|
||||
|
||||
var cancelled := MatchmakingState.new()
|
||||
cancelled.begin_queue("ticket-3", "casual")
|
||||
assert_true(cancelled.apply_proposal_update({"proposal_id": "proposal-3", "revision": 1, "state": "OPEN"}), "third proposal opens")
|
||||
cancelled.phase = MatchmakingState.CANCELLED
|
||||
assert_true(cancelled.apply_proposal_update({"proposal_id": "proposal-3", "revision": 2, "state": "DECLINED"}), "decline after ticket cancellation is accepted")
|
||||
assert_eq(cancelled.phase, MatchmakingState.CANCELLED, "proposal decline cannot resurrect a cancelled ticket")
|
||||
|
||||
|
||||
func test_proposal_projection_rejects_illegal_higher_revision_transitions() -> void:
|
||||
|
||||
Reference in New Issue
Block a user