MCPcopy Index your code
hub / github.com/dnote/dnote / TestDefaultBackendSendEmail

Function TestDefaultBackendSendEmail

pkg/server/mailer/backend_test.go:34–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestDefaultBackendSendEmail(t *testing.T) {
35 t.Run("sends email", func(t *testing.T) {
36 mock := &mockDialer{}
37 backend := &DefaultBackend{
38 Dialer: mock,
39 Templates: NewTemplates(),
40 }
41
42 data := WelcomeTmplData{
43 AccountEmail: "bob@example.com",
44 BaseURL: "https://example.com",
45 }
46
47 err := backend.SendEmail(EmailTypeWelcome, "alice@example.com", []string{"bob@example.com"}, data)
48 if err != nil {
49 t.Fatalf("SendEmail failed: %v", err)
50 }
51
52 if len(mock.sentMessages) != 1 {
53 t.Errorf("expected 1 message sent, got %d", len(mock.sentMessages))
54 }
55 })
56}
57
58func TestNewDefaultBackend(t *testing.T) {
59 t.Run("with all env vars set", func(t *testing.T) {

Callers

nothing calls this directly

Calls 2

SendEmailMethod · 0.95
NewTemplatesFunction · 0.85

Tested by

no test coverage detected