test(transcribe): a StatusError exposes its code as a kind, not its snippet (red; adversarial review F3)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package transcribe_test
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
@@ -15,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"git.d-ma.be/mathias/tapir/internal/adapters/transcribe"
|
"git.d-ma.be/mathias/tapir/internal/adapters/transcribe"
|
||||||
"git.d-ma.be/mathias/tapir/internal/domain"
|
"git.d-ma.be/mathias/tapir/internal/domain"
|
||||||
|
"git.d-ma.be/mathias/tapir/internal/errkind"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The httptest server stands in for the LiteLLM gateway: it is the process
|
// The httptest server stands in for the LiteLLM gateway: it is the process
|
||||||
@@ -230,3 +232,9 @@ func TestGateway_WithNoSegmentsTheTextFieldIsUsedWithWhitespaceCollapsed(t *test
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, "Hej allihopa. Vi börjar.", got.Text)
|
assert.Equal(t, "Hej allihopa. Vi börjar.", got.Text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStatusError_ExposesItsCodeAsAKindAndNotItsSnippet(t *testing.T) {
|
||||||
|
err := fmt.Errorf("transcribe: %w", &transcribe.StatusError{Code: 502, Snippet: "echoed: Anders ansvarar"})
|
||||||
|
|
||||||
|
assert.Equal(t, "http_502", errkind.Of(err))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user