Download this file
| 1 | package provision |
| 2 | |
| 3 | import ( |
| 4 | "slices" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | // Every registry app names the one prefix whose From its switched binary |
| 9 | // reads: CARLOS_SMTP (mail.FromCarlos("CARLOS")) for all but Docs, which |
| 10 | // reads DOCS_SMTP's. The prefix is one the binary also reads on SMTP, so |
| 11 | // a declaration that works on SMTP keeps working when switched. |
| 12 | func TestEveryAppNamesTheFromItsBinaryReads(t *testing.T) { |
| 13 | want := map[string]string{"docs": "DOCS_SMTP"} |
| 14 | for _, a := range Apps { |
| 15 | w := want[a.Slug] |
| 16 | if w == "" { |
| 17 | w = "CARLOS_SMTP" |
| 18 | } |
| 19 | if a.SubmitPrefix != w { |
| 20 | t.Errorf("%s: SubmitPrefix %q, want %q", a.Slug, a.SubmitPrefix, w) |
| 21 | } |
| 22 | if !slices.Contains(a.MailPrefixes, a.SubmitPrefix) { |
| 23 | t.Errorf("%s: SubmitPrefix %q is not one of its SMTP prefixes %v", a.Slug, a.SubmitPrefix, a.MailPrefixes) |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |