42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package processing
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"reflect"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestSEOMetaOnlySelectsEnrichmentPrerequisites(t *testing.T) {
|
||
|
|
steps := resolveSteps("seo_meta")
|
||
|
|
want := []string{StepNormalize, StepParseSpecs, StepFillFields, StepCategorize, StepAIEnhance}
|
||
|
|
if !reflect.DeepEqual(steps, want) {
|
||
|
|
t.Fatalf("seo_meta steps = %v, want %v", steps, want)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestSEOMetaAcceptedByPublicProcess(t *testing.T) {
|
||
|
|
storage, response, err := ParseV1ProcessingType("seo_meta")
|
||
|
|
if err != nil || storage != "seo_meta" || response != "seo_meta" {
|
||
|
|
t.Fatalf("ParseV1ProcessingType(seo_meta) = %q, %v, %v", storage, response, err)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestSEOMetaPartialResultIncludesMetaNotCopy(t *testing.T) {
|
||
|
|
input := []V1ProcessJobItem{{
|
||
|
|
"ean": "1234567890123", "name": "Existing name", "description": "Existing description",
|
||
|
|
"meta_title": "SEO title", "meta_description": "SEO description", "status": "completed",
|
||
|
|
}}
|
||
|
|
result := ProjectV1ProcessJobItems("seo_meta", input)
|
||
|
|
if len(result) != 1 {
|
||
|
|
t.Fatalf("items = %d", len(result))
|
||
|
|
}
|
||
|
|
item := result[0]
|
||
|
|
if item["meta_title"] != "SEO title" || item["meta_description"] != "SEO description" {
|
||
|
|
t.Fatalf("missing SEO metadata: %#v", item)
|
||
|
|
}
|
||
|
|
if _, found := item["name"]; found {
|
||
|
|
t.Fatalf("SEO-only response must not project title: %#v", item)
|
||
|
|
}
|
||
|
|
if _, found := item["description"]; found {
|
||
|
|
t.Fatalf("SEO-only response must not project description: %#v", item)
|
||
|
|
}
|
||
|
|
}
|