(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func 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 | |
| 55 | func 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--") |
nothing calls this directly
no test coverage detected