Files
2026-09-01 19:34:16 +01:00

22 lines
547 B
Go

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())
}
}