mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
22 lines
547 B
Go
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())
|
|
}
|
|
}
|