Superadmins can now change signup rules (on/off and the domain allow-list) and branding at runtime; the environment variables only seed the defaults. Mail and S3 storage settings pass through to PocketBase's own settings, and docwell-server sends its own emails through a PocketBase hook so there is a single SMTP configuration. The boot hook no longer wipes SMTP settings that were not set from the environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
643 B
Go
25 lines
643 B
Go
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
package mail
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestRender(t *testing.T) {
|
|
m, err := Render("a@b.test", "test", map[string]string{"AppName": "Acme <Wiki>"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if m.To != "a@b.test" || m.Subject != "Acme <Wiki> test email" {
|
|
t.Errorf("to/subject = %q / %q", m.To, m.Subject)
|
|
}
|
|
if !strings.Contains(m.HTML, "Acme <Wiki>") {
|
|
t.Errorf("html must escape the app name: %s", m.HTML)
|
|
}
|
|
if strings.Contains(m.Text, "test email\n") || !strings.HasPrefix(m.Text, "This is a test email") {
|
|
t.Errorf("text must not repeat the subject: %q", m.Text)
|
|
}
|
|
}
|