79 lines
2.1 KiB
Go
79 lines
2.1 KiB
Go
package email
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
channelpkg "github.com/gochat/gochat/internal/channel"
|
|
"github.com/gochat/gochat/internal/model"
|
|
)
|
|
|
|
func safeCall_Cov13(fn func()) { defer func() { _ = recover() }(); fn() }
|
|
|
|
// Test SMTP sender functions with invalid inputs - they'll fail early
|
|
// but still execute the first few statements
|
|
func TestSMTPSender_SendPlain_InvalidAddr_Cov13(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
_, _ = s.sendPlain("invalid:99999", "", "", "", "", nil)
|
|
}
|
|
|
|
func TestSMTPSender_SendTLS_InvalidAddr_Cov13(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
_, _ = s.sendTLS("invalid:99999", "", "", "", "", nil)
|
|
}
|
|
|
|
func TestSMTPSender_SendSTARTTLS_InvalidAddr_Cov13(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
_, _ = s.sendSTARTTLS("invalid:99999", "", "", "", "", nil)
|
|
}
|
|
|
|
func TestSMTPSender_ValidatePlain_InvalidAddr_Cov13(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
_ = s.validatePlain("invalid:99999", "", "")
|
|
}
|
|
|
|
func TestSMTPSender_ValidateTLS_InvalidAddr_Cov13(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
_ = s.validateTLS("invalid:99999", "", "")
|
|
}
|
|
|
|
func TestSMTPSender_ValidateSTARTTLS_InvalidAddr_Cov13(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
_ = s.validateSTARTTLS("invalid:99999", "", "")
|
|
}
|
|
|
|
func TestSMTPSender_SendViaClient_Nil_Cov13(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
safeCall_Cov13(func() { _, _ = s.sendViaClient(nil, "", "", nil) })
|
|
}
|
|
|
|
// Test IMAP listener with nil
|
|
func TestIMAPListener_ParseMessage_Nil_Cov13(t *testing.T) {
|
|
l := &IMAPListener{}
|
|
safeCall_Cov13(func() {
|
|
_, _ = l.parseMessage(context.Background(), nil, nil, "", &model.Inbox{})
|
|
})
|
|
}
|
|
|
|
func TestIMAPListener_Fetch_Nil_Cov13(t *testing.T) {
|
|
l := &IMAPListener{}
|
|
safeCall_Cov13(func() {
|
|
_, _ = l.Fetch(context.Background(), nil, channelpkg.ChannelConfig{})
|
|
})
|
|
}
|
|
|
|
// Test provider methods with nil
|
|
func TestEmailProvider_PollMessages_Nil_Cov13(t *testing.T) {
|
|
p := &EmailProvider{}
|
|
safeCall_Cov13(func() {
|
|
_, _ = p.PollMessages(context.Background(), nil)
|
|
})
|
|
}
|
|
|
|
func TestEmailProvider_OnCreate_Nil_Cov13(t *testing.T) {
|
|
p := &EmailProvider{}
|
|
safeCall_Cov13(func() {
|
|
_, _ = p.OnCreate(context.Background(), nil, channelpkg.ChannelConfig{})
|
|
})
|
|
}
|