mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-14 09:32:07 +00:00
feat(multiplayer): model initial connect outcomes
This commit is contained in:
@@ -41,3 +41,26 @@ func TestCasualWaitsThenStartsWithBotsOnlyWithHumanOnEachTeam(t *testing.T) {
|
||||
t.Fatalf("empty-team decision = %+v err=%v", decision, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPlanInitialConnectMakesLifecycleActionExplicit(t *testing.T) {
|
||||
readyAt := time.Unix(1000, 0)
|
||||
participants := sixConnectParticipants(0, 1)
|
||||
plan, err := PlanInitialConnect(Casual, readyAt, readyAt.Add(CasualBotStartAfter), participants, nil)
|
||||
if err != nil || plan.Action != InitialConnectStartWithBot || plan.MatchState != Live || len(plan.CasualLineup) != 6 || len(plan.NoShows) != 4 {
|
||||
t.Fatalf("casual initial-connect plan = %+v err=%v", plan, err)
|
||||
}
|
||||
botCount := 0
|
||||
for _, slot := range plan.CasualLineup {
|
||||
if slot.IsBot {
|
||||
botCount++
|
||||
}
|
||||
}
|
||||
if botCount != 4 {
|
||||
t.Fatalf("casual plan bot count = %d, want 4", botCount)
|
||||
}
|
||||
|
||||
ranked, err := PlanInitialConnect(Ranked, readyAt, readyAt.Add(InitialConnectWindow), sixConnectParticipants(0, 1, 2, 3, 4), nil)
|
||||
if err != nil || ranked.Action != InitialConnectCancel || ranked.MatchState != Cancelled || len(ranked.CasualLineup) != 0 || len(ranked.Connected) != 5 {
|
||||
t.Fatalf("ranked initial-connect plan = %+v err=%v", ranked, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user