package explainer import ( "strings" "testing" ) func TestFormatSummary(t *testing.T) { cases := []struct { name string in string wantPlain string wantHTML string }{ { name: "dash bullets", in: "- First point.\n- Second point.\n- Third point.", wantPlain: "• First point.\n• Second point.\n• Third point.", wantHTML: "
") || !strings.HasSuffix(htmlBody, "") { t.Errorf("html should wrap raw in
, got %q", htmlBody)
}
if !strings.Contains(htmlBody, "single paragraph") {
t.Errorf("html should contain the body text, got %q", htmlBody)
}
}
func TestIsQuestionReaction(t *testing.T) {
want := []string{"❓", "❔", "⁉", "⁉️", "🤔", "?", "?"}
for _, k := range want {
if !IsQuestionReaction(k) {
t.Errorf("expected %q to trigger explain", k)
}
}
notQuestion := []string{"👍", "👎", "🔥", "", "??", "❤️"}
for _, k := range notQuestion {
if IsQuestionReaction(k) {
t.Errorf("expected %q to NOT trigger explain", k)
}
}
}