feat(notification): add durable mail delivery state
This commit is contained in:
1 parent
391c8a6cec
commit
2db585fbff
41 files changed
+4903
-108
No files matched your search
@@ -306,9 +306,20 @@ func TestContentHashPinsTheBody(t *testing.T) {
|
||||
if mail.ContentHash() != second[kind].ContentHash() {
|
||||
t.Fatalf("%s content hash differs for the same version and data", kind)
|
||||
}
|
||||
if mail.ContentHash() != contentHash(string(mail.TemplateVersion()), mail.Subject(), mail.Text(), mail.HTML()) {
|
||||
if mail.ContentHash() != ContentHash(domain.MailContentHash(string(mail.TemplateVersion()), mail.Subject(), mail.Text(), mail.HTML())) {
|
||||
t.Fatalf("%s content hash does not cover the version, subject, and parts", kind)
|
||||
}
|
||||
// A delivery stores the rendering as domain.MailContent; both forms
|
||||
// must name the same kind, version, parts, and hash.
|
||||
content, err := mail.Content()
|
||||
if err != nil {
|
||||
t.Fatalf("%s Content() error = %v", kind, err)
|
||||
}
|
||||
if string(content.Kind()) != string(kind) || content.TemplateVersion() != string(mail.TemplateVersion()) ||
|
||||
content.Subject() != mail.Subject() || content.Text() != mail.Text() || content.HTML() != mail.HTML() ||
|
||||
ContentHash(content.Hash()) != mail.ContentHash() {
|
||||
t.Fatalf("%s Content() does not carry the rendering", kind)
|
||||
}
|
||||
seen[mail.ContentHash()] = kind
|
||||
}
|
||||
if len(seen) != len(first) {
|
||||
@@ -350,19 +361,6 @@ func TestContentHashPinsTheBody(t *testing.T) {
|
||||
t.Fatalf("content hash did not change with the %s", change.name)
|
||||
}
|
||||
}
|
||||
|
||||
base := contentHash("verification.v1", "subject", "text", "html")
|
||||
for name, other := range map[string]ContentHash{
|
||||
"version": contentHash("verification.v2", "subject", "text", "html"),
|
||||
"subject": contentHash("verification.v1", "subject!", "text", "html"),
|
||||
"text": contentHash("verification.v1", "subject", "text!", "html"),
|
||||
"html": contentHash("verification.v1", "subject", "text", "html!"),
|
||||
"shifted border": contentHash("verification.v1", "subjec", "ttext", "html"),
|
||||
} {
|
||||
if other == base {
|
||||
t.Fatalf("content hash ignores a change of the %s", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestRenderingNeverReachesLogs plays the render harness: it prints every
|
||||
|
||||
Reference in new issue
Block a user