Keep capacity cancellation tests independent of implementation details

This commit is contained in:
2026-07-29 22:41:12 +00:00
parent e61ab700c7
commit be67707582
3 changed files with 26 additions and 98 deletions

22
errors_internal_test.go Normal file
View File

@@ -0,0 +1,22 @@
package promptkit
import (
"context"
"errors"
"fmt"
"testing"
"gitea.maximumdirect.net/eric/promptkit/internal/usecase"
)
func TestMapPublicErrorPreservesGenerationCancellation(t *testing.T) {
internalErr := fmt.Errorf("%w: %w", usecase.ErrLLMGenerate, context.Canceled)
err := mapPublicError(internalErr)
if !errors.Is(err, ErrLLMGenerate) {
t.Fatalf("mapped error=%v, want ErrLLMGenerate", err)
}
if !errors.Is(err, context.Canceled) {
t.Fatalf("mapped error=%v, want context.Canceled", err)
}
}