mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
fix(multiplayer): align proposal participant contract
This commit is contained in:
@@ -174,6 +174,20 @@ func test_rest_responses_reject_malformed_resource_identifiers() -> void:
|
||||
client.free()
|
||||
|
||||
|
||||
func test_proposal_response_requires_structured_unique_participants() -> void:
|
||||
var base := {"proposal_id": "proposal_1234567890", "participants": [
|
||||
{"player_id": "player_1234567890", "response": "PENDING", "team": 0, "slot": 0},
|
||||
{"player_id": "player_1234567891", "response": "PENDING", "team": 1, "slot": 3}
|
||||
]}
|
||||
assert_true(ControlPlaneClient._valid_proposal_response(base), "structured proposal participants are accepted")
|
||||
var duplicate := base.duplicate(true)
|
||||
duplicate["participants"][1]["player_id"] = "player_1234567890"
|
||||
assert_true(not ControlPlaneClient._valid_proposal_response(duplicate), "duplicate participant identity is rejected")
|
||||
var fractional_slot := base.duplicate(true)
|
||||
fractional_slot["participants"][0]["slot"] = 0.5
|
||||
assert_true(not ControlPlaneClient._valid_proposal_response(fractional_slot), "fractional participant slot is rejected")
|
||||
|
||||
|
||||
func test_assignment_endpoint_split_never_accepts_url_or_bad_port() -> void:
|
||||
var endpoint := ControlPlaneClient._split_assignment_endpoint("127.0.0.1:31001")
|
||||
assert_eq(endpoint["host"], "127.0.0.1", "assignment host is separated from the port")
|
||||
|
||||
Reference in New Issue
Block a user