41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
package company
|
|||
|
|
|
||
|
|
import "testing"
|
||
|
|
|
||
|
|
func TestLooksLikeHeuristicSynthesize(t *testing.T) {
|
||
|
|
t.Parallel()
|
||
|
|
title := "Vogel's WALL 3245 TV Wall Mount"
|
||
|
|
en := title + " is a TV Mounts product from Vogel's. Key specs: width 45 cm, max_load 40 kg."
|
||
|
|
if !LooksLikeHeuristicSynthesize(en) {
|
||
|
|
t.Fatalf("expected EN invent detected: %q", en)
|
||
|
|
}
|
||
|
|
sl := title + " je izdelek v kategoriji TV Mounts znamke Vogel's. Ključne specifikacije: width 45 cm."
|
||
|
|
if !LooksLikeHeuristicSynthesize(sl) {
|
||
|
|
t.Fatalf("expected SL invent detected: %q", sl)
|
||
|
|
}
|
||
|
|
good := "Vogel's WALL 3245 is a sturdy TV mount with clear load ratings and install guidance for wall displays."
|
||
|
|
if LooksLikeHeuristicSynthesize(good) {
|
||
|
|
t.Fatalf("retail copy must not look like invent: %q", good)
|
||
|
|
}
|
||
|
|
if !ShouldRefuseEnhanceHashSkip(en, title) {
|
||
|
|
t.Fatal("invent must refuse hash skip")
|
||
|
|
}
|
||
|
|
if ShouldRefuseEnhanceHashSkip(good, title) {
|
||
|
|
t.Fatal("good retail copy must allow hash skip")
|
||
|
|
}
|
||
|
|
if !ShouldRefuseEnhanceHashSkip(title, title) {
|
||
|
|
t.Fatal("title-echo must refuse hash skip")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestDescriptionMissingFormulaHTMLTags(t *testing.T) {
|
||
|
|
t.Parallel()
|
||
|
|
types := []string{"h1", "p", "ul"}
|
||
|
|
if !DescriptionMissingFormulaHTMLTags("plain prose without tags", types) {
|
||
|
|
t.Fatal("plain prose must mismatch")
|
||
|
|
}
|
||
|
|
if DescriptionMissingFormulaHTMLTags("<h1>T</h1><p>Body</p><ul><li>x</li></ul>", types) {
|
||
|
|
t.Fatal("full HTML must match")
|
||
|
|
}
|
||
|
|
}
|