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