mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 22:52:03 +00:00
fix(multiplayer): validate ticket timestamps
This commit is contained in:
@@ -90,6 +90,15 @@ func test_ticket_update_rejects_invalid_playlist_without_mutation() -> void:
|
||||
assert_eq(state.playlist, "casual", "invalid playlist cannot change playlist")
|
||||
|
||||
|
||||
func test_ticket_and_proposal_epoch_metadata_rejects_malformed_values() -> void:
|
||||
var state := MatchmakingState.new()
|
||||
state.begin_queue("ticket-epoch", "casual")
|
||||
assert_true(not state.apply_ticket_update({"ticket_id": "ticket-epoch", "revision": 1, "state": "PROPOSED", "expires_at_unix": "not-a-time"}), "malformed ticket expiry is rejected")
|
||||
assert_eq(state.phase, MatchmakingState.QUEUED, "malformed ticket expiry cannot change phase")
|
||||
assert_true(not state.apply_ticket_update({"ticket_id": "ticket-epoch", "revision": 1, "state": "PROPOSED", "enqueued_at_unix": -1}), "negative enqueue time is rejected")
|
||||
assert_true(not state.apply_proposal_update({"proposal_id": "proposal-epoch", "revision": 1, "state": "OPEN", "expires_at_unix": 1.25}), "fractional proposal expiry is rejected")
|
||||
|
||||
|
||||
func test_proposal_terminal_states_are_visible_and_not_cancellable() -> void:
|
||||
var state := MatchmakingState.new()
|
||||
state.begin_queue("ticket-1", "casual")
|
||||
|
||||
Reference in New Issue
Block a user