mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
test(multiplayer): cover cooldown response boundary
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user