This repository has been archived on 2026-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
ollie-core/backend/codewhisperer_test.go

27 lines
721 B
Go

package backend
import (
"net/http"
"testing"
)
func TestKiroAPIError_IsThrottled(t *testing.T) {
tests := []struct {
name string
err kiroAPIError
expect bool
}{
{"429 status", kiroAPIError{StatusCode: http.StatusTooManyRequests}, true},
{"ThrottlingException code", kiroAPIError{Code: "ThrottlingException", StatusCode: 400}, true},
{"401 not throttled", kiroAPIError{StatusCode: http.StatusUnauthorized}, false},
{"other code", kiroAPIError{Code: "ValidationException", StatusCode: 400}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := tt.err.isThrottled(); got != tt.expect {
t.Errorf("isThrottled() = %v, want %v", got, tt.expect)
}
})
}
}