rano/mailer/message/render_test.go

32 lines
509 B
Go
Raw Normal View History

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)
}
}