package main import "testing" func TestVerifyTelegramSecret(t *testing.T) { cases := []struct { name string provided, expect string want bool }{ {"empty expected refuses anything", "anything", "", false}, {"empty provided refuses", "", "secret", false}, {"match", "topsecret", "topsecret", true}, {"mismatch same length", "topSecret", "topsecret", false}, {"mismatch different length", "topsecret", "topsecretextra", false}, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { got := verifyTelegramSecret(c.provided, c.expect) if got != c.want { t.Errorf("verify(%q,%q) = %v, want %v", c.provided, c.expect, got, c.want) } }) } } func TestTruncate(t *testing.T) { if got := truncate("short", 100); got != "short" { t.Errorf("short string changed: %q", got) } if got := truncate("123456789", 5); got != "12345…" { t.Errorf("long string trunc wrong: %q", got) } }