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,38 @@
|
||||
package email
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUnsubscribeInfoOmitsTenantPII(t *testing.T) {
|
||||
t.Parallel()
|
||||
info := UnsubscribeInfo{
|
||||
OK: true,
|
||||
AlreadyDone: true,
|
||||
Message: "already unsubscribed",
|
||||
}
|
||||
b, err := json.Marshal(info)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
raw := string(b)
|
||||
for _, leak := range []string{"company_id", "email"} {
|
||||
if strings.Contains(raw, leak) {
|
||||
t.Fatalf("public unsubscribe JSON must not include %q: %s", leak, raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestClampUnsubscribeReason(t *testing.T) {
|
||||
t.Parallel()
|
||||
long := strings.Repeat("a", maxUnsubscribeReasonLen+50)
|
||||
got := clampUnsubscribeReason(long)
|
||||
if len(got) != maxUnsubscribeReasonLen {
|
||||
t.Fatalf("len=%d want %d", len(got), maxUnsubscribeReasonLen)
|
||||
}
|
||||
if got := clampUnsubscribeReason(" ok "); got != "ok" {
|
||||
t.Fatalf("trim failed: %q", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user