Skip to content

Commit 1ce83dc

Browse files
Dusan KasanDusan Kasan
authored andcommitted
test brought in line with the others
1 parent 9b69db4 commit 1ce83dc

1 file changed

Lines changed: 25 additions & 21 deletions

File tree

parsemail_test.go

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,31 @@ So, "Hello".`,
358358
},
359359
},
360360
},
361+
12: {
362+
contentType: "multipart/related; boundary=\"000000000000ab2e2205a26de587\"",
363+
mailData: multipartRelatedExample,
364+
subject: "Saying Hello",
365+
from: []mail.Address{
366+
{
367+
Name: "John Doe",
368+
Address: "jdoe@machine.example",
369+
},
370+
},
371+
sender: mail.Address{
372+
Name: "Michael Jones",
373+
Address: "mjones@machine.example",
374+
},
375+
to: []mail.Address{
376+
{
377+
Name: "Mary Smith",
378+
Address: "mary@example.net",
379+
},
380+
},
381+
messageID: "1234@local.machine.example",
382+
date: parseDate("Fri, 21 Nov 1997 09:55:06 -0600"),
383+
htmlBody: "<div dir=\"ltr\"><div>Time for the egg.</div><div><br></div><div><br><br></div></div>",
384+
textBody: "Time for the egg.",
385+
},
361386
}
362387

363388
for index, td := range testData {
@@ -540,27 +565,6 @@ So, "Hello".`,
540565
}
541566
}
542567

543-
func TestMultiPartRelatedEmail(t *testing.T) {
544-
email, err := Parse(strings.NewReader(multipartRelatedExample))
545-
if err != nil {
546-
t.Errorf("[Test Multipart Related] Emailed failed to parse: %v", err)
547-
}
548-
549-
if len(email.TextBody) == 0 {
550-
t.Errorf("[Test Multipart Related] Failed to parse multipart related at the top level.")
551-
}
552-
body := "Time for the egg."
553-
fmt.Println(email.TextBody)
554-
if email.TextBody != body {
555-
t.Errorf("Test Multipart Related] Body didn't match. \nExpected: %v,\nbut got: %v", body, email.TextBody)
556-
}
557-
558-
html := "<div dir=\"ltr\"><div>Time for the egg.</div><div><br></div><div><br><br></div></div>"
559-
if email.HTMLBody != html {
560-
t.Errorf("Test Multipart Related] HTML didn't match. \nExpected: %v,\nbut got: %v", html, email.TextBody)
561-
}
562-
}
563-
564568
func parseDate(in string) time.Time {
565569
out, err := time.Parse(time.RFC1123Z, in)
566570
if err != nil {

0 commit comments

Comments
 (0)