Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package processing
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestClientErrorRecognizesRateLimit(t *testing.T) {
|
||||
msg, ok := ClientError(ErrRateLimited)
|
||||
if !ok {
|
||||
t.Fatal("expected ErrRateLimited to be a client error")
|
||||
}
|
||||
if msg != ErrRateLimited.Error() {
|
||||
t.Fatalf("msg=%q", msg)
|
||||
}
|
||||
if !errors.Is(ErrRateLimited, ErrRateLimited) {
|
||||
t.Fatal("sentinel identity broken")
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientErrorRecognizesWrappedTooManyProducts(t *testing.T) {
|
||||
err := fmt.Errorf("%w (max %d)", ErrTooManyProducts, 50)
|
||||
msg, ok := ClientError(err)
|
||||
if !ok {
|
||||
t.Fatal("expected wrapped ErrTooManyProducts")
|
||||
}
|
||||
if msg != "too many products (max 50)" {
|
||||
t.Fatalf("msg=%q", msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientErrorRejectsOpaqueErrors(t *testing.T) {
|
||||
if _, ok := ClientError(errors.New("pq: connection refused")); ok {
|
||||
t.Fatal("opaque DB error must not be treated as client-safe")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user