23 lines
517 B
Go
23 lines
517 B
Go
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)
|
|
}
|
|
}
|