fix(multiplayer): validate ranked arena paths durably

This commit is contained in:
Josh Creek
2026-09-01 21:07:56 +01:00
parent ff80ab46b7
commit bd617dbf06
8 changed files with 62 additions and 7 deletions
+29
View File
@@ -0,0 +1,29 @@
package store
import (
"testing"
"github.com/cosmic-clash/cosmic-clash/server/domain"
)
func TestRankedProposalMatchPlanRequiresRegisteredArenaPath(t *testing.T) {
proposal := domain.Proposal{
Playlist: domain.Ranked,
Region: "EU",
Protocol: 1,
ArenaPath: "res://scenes/arena_01.tscn",
Participants: []domain.ProposalParticipant{
{PlayerID: "player-a", Team: 0, Slot: 0},
{PlayerID: "player-b", Team: 1, Slot: 3},
},
}
if !validProposalMatchPlan(proposal) {
t.Fatal("registered ranked arena rejected")
}
for _, path := range []string{"", "res://scenes/arena_01_elevated.tscn", "res://forged.tscn"} {
proposal.ArenaPath = path
if validProposalMatchPlan(proposal) {
t.Fatalf("ranked path %q accepted", path)
}
}
}