Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package campaigns
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestListTemplates(t *testing.T) {
|
||||
tpls := ListTemplates()
|
||||
if len(tpls) != 4 {
|
||||
t.Fatalf("expected 4 templates, got %d", len(tpls))
|
||||
}
|
||||
for _, key := range []string{"christmas", "black_friday", "spring", "custom"} {
|
||||
if !ValidTemplateKey(key) {
|
||||
t.Fatalf("expected valid key %s", key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeEmail(t *testing.T) {
|
||||
e, err := NormalizeEmail(" User@Example.COM ")
|
||||
if err != nil || e != "user@example.com" {
|
||||
t.Fatalf("got %q err=%v", e, err)
|
||||
}
|
||||
if _, err := NormalizeEmail("not-an-email"); err == nil {
|
||||
t.Fatal("expected error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnsubscribeFooter(t *testing.T) {
|
||||
html, plain := EnsureUnsubscribeFooter("<p>Hi</p>", "Hi", "https://example.com/unsubscribe?token=abc")
|
||||
if !HasUnsubscribeFooter(html) {
|
||||
t.Fatalf("missing footer in %s", html)
|
||||
}
|
||||
if plain == "" {
|
||||
t.Fatal("plain empty")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user