MCPcopy Create free account
hub / github.com/buggregator/server / TestParseEmail_HTML

Function TestParseEmail_HTML

modules/smtp/handler_test.go:40–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38}
39
40func TestParseEmail_HTML(t *testing.T) {
41 raw := []byte("From: sender@example.com\r\nTo: recipient@example.com\r\nSubject: HTML Test\r\nContent-Type: text/html\r\n\r\n<p>Hello HTML</p>")
42
43 parsed, _, err := parseEmail(raw, []string{"recipient@example.com"})
44 if err != nil {
45 t.Fatal(err)
46 }
47 if parsed.HTML != "<p>Hello HTML</p>" {
48 t.Errorf("HTML = %q", parsed.HTML)
49 }
50 if parsed.Text != "" {
51 t.Errorf("Text should be empty")
52 }
53}
54
55func TestParseEmail_Multipart(t *testing.T) {
56 raw := []byte("From: sender@example.com\r\nTo: recipient@example.com\r\nSubject: Multipart Test\r\nContent-Type: multipart/alternative; boundary=\"boundary123\"\r\nMessage-ID: <multi@example.com>\r\n\r\n--boundary123\r\nContent-Type: text/plain\r\n\r\nPlain text body\r\n--boundary123\r\nContent-Type: text/html\r\n\r\n<p>HTML body</p>\r\n--boundary123--")

Callers

nothing calls this directly

Calls 1

parseEmailFunction · 0.85

Tested by

no test coverage detected