package api import ( "net/http" "net/http/httptest" "strings" "testing" "github.com/cosmic-clash/cosmic-clash/server/domain" ) func TestCooldownDomainErrorIsRetryableButNotAConflict(t *testing.T) { recorder := httptest.NewRecorder() writeDomainError(recorder, domain.ErrPlayerCooldown) if recorder.Code != http.StatusTooManyRequests { t.Fatalf("cooldown status = %d, want 429", recorder.Code) } if !strings.Contains(recorder.Body.String(), "matchmaking_cooldown") { t.Fatalf("cooldown response = %q", recorder.Body.String()) } }