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