-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmail_text_test.go
More file actions
39 lines (34 loc) · 951 Bytes
/
Copy pathmail_text_test.go
File metadata and controls
39 lines (34 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"strings"
"testing"
"time"
)
func TestPlainTextPartIncludesWhatWhyHow(t *testing.T) {
t.Parallel()
fc := &FileContent{
Address: "Test St",
FarsiOutageDate: "1405/05/17",
StartOutageDateTime: time.Date(2026, 8, 8, 10, 0, 0, 0, time.UTC),
EndOutageDateTime: time.Date(2026, 8, 8, 12, 0, 0, 0, time.UTC),
ReasonOutage: "maintenance",
}
body := plainTextPart("bound", fc, MailKindNew)
for _, want := range []string{
"Content-Type: text/plain",
"planned power outage",
"listed as a recipient",
"Address: Test St",
"Reason: maintenance",
"How to add this to your calendar",
"invite.ics",
} {
if !strings.Contains(body, want) {
t.Fatalf("plain text missing %q\nbody:\n%s", want, body)
}
}
update := plainTextPart("bound", fc, MailKindUpdate)
if !strings.Contains(update, "schedule has changed") {
t.Fatalf("update body missing change notice:\n%s", update)
}
}