fix
This commit is contained in:
1 parent
8b540d22bc
commit
c92ee93482
24 files changed
+1495
-327
No files matched your search
@@ -5,7 +5,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/descrybe/descrybe-v2/apps/api/internal/billing"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
@@ -349,42 +348,29 @@ func TestCompanyOmitsSEOMetaID(t *testing.T) {
|
||||
t.Parallel()
|
||||
a1 := uuid.MustParse("604f23a8-b66e-4b21-8b45-0d72b68f4790")
|
||||
demo := uuid.MustParse("2b3159b0-fc08-415b-b248-35ed02a6baab")
|
||||
legacy := uuid.MustParse(billing.A1LegacyCompanyID)
|
||||
other := uuid.MustParse("11111111-1111-1111-1111-111111111111")
|
||||
if !CompanyOmitsSEOMetaID(a1) || !CompanyOmitsSEOMetaID(demo) || !CompanyOmitsSEOMetaID(legacy) {
|
||||
t.Fatal("A1, Demo, and legacy A1 ids must omit SEO meta")
|
||||
if CompanyOmitsSEOMetaID(a1) || !CompanyOmitsSEOMetaID(demo) {
|
||||
t.Fatal("A1 must emit SEO meta; Demo remains suppressed")
|
||||
}
|
||||
if CompanyOmitsSEOMetaID(other) || CompanyOmitsSEOMetaID(uuid.Nil) {
|
||||
t.Fatal("unrelated company ids must keep SEO meta")
|
||||
if CompanyOmitsSEOMetaLookup(a1, "", "A1 Slovenija") {
|
||||
t.Fatal("A1 production company must not suppress SEO meta")
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyV1SEOMetaPolicy_omitsOnlyA1(t *testing.T) {
|
||||
func TestApplyV1SEOMetaPolicy_keepsA1AndOmitsDemo(t *testing.T) {
|
||||
t.Parallel()
|
||||
item := V1ProcessJobItem{
|
||||
"ean": "1",
|
||||
"status": "processed",
|
||||
"meta_title": "T",
|
||||
"meta_description": "D",
|
||||
}
|
||||
item := V1ProcessJobItem{"ean": "1", "meta_title": "T", "meta_description": "D"}
|
||||
a1 := uuid.MustParse("604f23a8-b66e-4b21-8b45-0d72b68f4790")
|
||||
out := ApplyV1SEOMetaPolicy(a1, []V1ProcessJobItem{item})
|
||||
if _, ok := out[0]["meta_title"]; ok {
|
||||
t.Fatal("A1 must omit meta_title")
|
||||
}
|
||||
if _, ok := out[0]["meta_description"]; ok {
|
||||
t.Fatal("A1 must omit meta_description")
|
||||
}
|
||||
keep := V1ProcessJobItem{
|
||||
"ean": "1",
|
||||
"status": "processed",
|
||||
"meta_title": "T",
|
||||
"meta_description": "D",
|
||||
}
|
||||
other := uuid.MustParse("11111111-1111-1111-1111-111111111111")
|
||||
kept := ApplyV1SEOMetaPolicy(other, []V1ProcessJobItem{keep})
|
||||
kept := ApplyV1SEOMetaPolicy(a1, []V1ProcessJobItem{item})
|
||||
if kept[0]["meta_title"] != "T" || kept[0]["meta_description"] != "D" {
|
||||
t.Fatalf("non-A1 must keep SEO meta: %v", kept[0])
|
||||
t.Fatal("A1 SEO metadata must be retained")
|
||||
}
|
||||
demo := uuid.MustParse("2b3159b0-fc08-415b-b248-35ed02a6baab")
|
||||
stripped := ApplyV1SEOMetaPolicy(demo, []V1ProcessJobItem{item})
|
||||
if _, ok := stripped[0]["meta_title"]; ok {
|
||||
t.Fatal("Demo meta title must be omitted")
|
||||
}
|
||||
if _, ok := stripped[0]["meta_description"]; ok {
|
||||
t.Fatal("Demo meta description must be omitted")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user