working on auth.

mailer, basic setup with html template and a dev treansport
This commit is contained in:
2024-11-15 21:42:15 +05:30
parent b0db98452a
commit 26a00c9f7c
45 changed files with 923 additions and 252 deletions

View File

@@ -0,0 +1,31 @@
package message
import (
"strings"
"testing"
)
type testmail struct {
Message string
}
func (t testmail) Subject() string {
return "Test Test"
}
func (t testmail) HtmlBody() (string, error) {
content := `<p>{{.Message}}</p>`
return render(layout, content, t)
}
func TestRender(t *testing.T) {
tpl := testmail{
Message: "some mesage",
}
if b, err := tpl.HtmlBody(); err != nil {
t.Error(err)
} else if !strings.Contains(b, tpl.Message) {
t.Error("supposed to contain:", tpl.Message)
}
}