fixes
This commit is contained in:
1 parent
c347d2418f
commit
1ad180a052
49 files changed
+6339
-89
No files matched your search
@@ -2,7 +2,6 @@ package processing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -63,20 +62,15 @@ func TestTryAICategorize_rejectsInventedID(t *testing.T) {
|
||||
}},
|
||||
Vector: NoopVectorCategorizer{},
|
||||
}
|
||||
// An id outside the taxonomy means the category could not be determined. The
|
||||
// product must fail rather than continue uncategorised into enhance, which
|
||||
// would generate copy with no formula behind it.
|
||||
// An id outside the taxonomy is never stored; the product continues uncategorized.
|
||||
out, err := e.RunSteps(context.Background(), "co", ProductInput{
|
||||
Name: "Widget",
|
||||
CategoryNamesByUID: map[string]string{
|
||||
"50": "Štedilniki",
|
||||
},
|
||||
}, "full", nil, StepPolicy{AllowAI: true})
|
||||
if !errors.Is(err, ErrCategoryNotFound) {
|
||||
t.Fatalf("err=%v want ErrCategoryNotFound", err)
|
||||
}
|
||||
if !strings.Contains(err.Error(), "99999") {
|
||||
t.Fatalf("error should name the rejected id, got %v", err)
|
||||
if err != nil {
|
||||
t.Fatalf("an invented id must not fail the product, got %v", err)
|
||||
}
|
||||
if out.Category != "" {
|
||||
t.Fatalf("Category=%q want empty (invented id rejected)", out.Category)
|
||||
|
||||
Reference in new issue
Block a user