Files

29 lines
548 B
Go
Raw Permalink Normal View History

2026-08-15 01:38:05 +08:00
package mailgun
import (
"context"
"testing"
mailx "code.yun.ink/pkg/mailx"
)
var _ mailx.Sender = (*MailGun)(nil)
func TestName(t *testing.T) {
if got := New(Config{}).Name(); got != "mailgun" {
t.Errorf("Name() = %q, want mailgun", got)
}
}
func TestSendWithoutSender(t *testing.T) {
// 缺少 Sender 时应立即报错,不调用 mailgun SDK
g := New(Config{})
err := g.Send(context.Background(), mailx.NewMessage().
To("a@b.com").
Subject("s").
Build())
if err == nil {
t.Fatal("Send without sender should error")
}
}