101 lines
3.7 KiB
Go
101 lines
3.7 KiB
Go
package whatsapp
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func safeCall_Cov11(fn func()) { defer func() { _ = recover() }(); fn() }
|
|
|
|
// --- Repository tests ---
|
|
func TestRepository_Create_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _ = r.Create(context.Background(), nil) })
|
|
}
|
|
func TestRepository_Update_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _ = r.Update(context.Background(), nil) })
|
|
}
|
|
func TestRepository_UpdateAccessToken_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _ = r.UpdateAccessToken(context.Background(), 0, "") })
|
|
}
|
|
func TestRepository_MarkReauthorizationRequired_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _ = r.MarkReauthorizationRequired(context.Background(), 0) })
|
|
}
|
|
func TestRepository_ClearReauthorizationRequired_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _ = r.ClearReauthorizationRequired(context.Background(), 0) })
|
|
}
|
|
func TestRepository_GetByID_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _, _ = r.GetByID(context.Background(), 0) })
|
|
}
|
|
func TestRepository_GetByPhoneNumberID_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _, _ = r.GetByPhoneNumberID(context.Background(), "") })
|
|
}
|
|
func TestRepository_FindByAccountID_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _, _ = r.FindByAccountID(context.Background(), 0) })
|
|
}
|
|
func TestRepository_Delete_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _ = r.Delete(context.Background(), 0) })
|
|
}
|
|
func TestInboxRepository_FindByPhoneNumberID_Nil_Cov11(t *testing.T) {
|
|
r := &InboxRepository{}
|
|
safeCall_Cov11(func() { _, _ = r.FindByPhoneNumberID(context.Background(), "") })
|
|
}
|
|
func TestInboxRepository_FindByID_Nil_Cov11(t *testing.T) {
|
|
r := &InboxRepository{}
|
|
safeCall_Cov11(func() { _, _ = r.FindByID(context.Background(), 0) })
|
|
}
|
|
|
|
// --- Service tests ---
|
|
func TestWhatsAppService_CreateChannel_Nil_Cov11(t *testing.T) {
|
|
s := &WhatsAppService{}
|
|
safeCall_Cov11(func() { _, _ = s.CreateChannel(context.Background(), 0, nil) })
|
|
}
|
|
func TestWhatsAppService_UpdateChannel_Nil_Cov11(t *testing.T) {
|
|
s := &WhatsAppService{}
|
|
safeCall_Cov11(func() { _, _ = s.UpdateChannel(context.Background(), 0, nil) })
|
|
}
|
|
func TestWhatsAppService_DeleteChannel_Nil_Cov11(t *testing.T) {
|
|
s := &WhatsAppService{}
|
|
safeCall_Cov11(func() { _ = s.DeleteChannel(context.Background(), 0) })
|
|
}
|
|
func TestWhatsAppService_GetPhoneNumberDetails_Nil_Cov11(t *testing.T) {
|
|
s := &WhatsAppService{}
|
|
safeCall_Cov11(func() { _, _ = s.GetPhoneNumberDetails(context.Background(), nil) })
|
|
}
|
|
func TestWhatsAppService_FetchMessageTemplates_Nil_Cov11(t *testing.T) {
|
|
s := &WhatsAppService{}
|
|
safeCall_Cov11(func() { _, _ = s.FetchMessageTemplates(context.Background(), nil) })
|
|
}
|
|
func TestWhatsAppService_SetupWebhook_Nil_Cov11(t *testing.T) {
|
|
s := &WhatsAppService{}
|
|
safeCall_Cov11(func() { _ = s.SetupWebhook(context.Background(), nil, "") })
|
|
}
|
|
|
|
// --- Media tests ---
|
|
func TestMediaService_DownloadAttachment_Nil_Cov11(t *testing.T) {
|
|
ms := &MediaService{}
|
|
safeCall_Cov11(func() { _, _ = ms.DownloadAttachment(context.Background(), "", "", "") })
|
|
}
|
|
func TestMediaService_DownloadWhatsAppMedia_Nil_Cov11(t *testing.T) {
|
|
ms := &MediaService{}
|
|
safeCall_Cov11(func() { _, _ = ms.DownloadWhatsAppMedia(context.Background(), "", WAMediaContent{}, "") })
|
|
}
|
|
func TestMediaService_DownloadWhatsAppDocument_Nil_Cov11(t *testing.T) {
|
|
ms := &MediaService{}
|
|
safeCall_Cov11(func() { _, _ = ms.DownloadWhatsAppDocument(context.Background(), WADocumentContent{}, "") })
|
|
}
|
|
|
|
// --- Pipeline tests ---
|
|
func TestIncomingPipeline_ProcessStatuses_Nil_Cov11(t *testing.T) {
|
|
p := &IncomingPipeline{}
|
|
safeCall_Cov11(func() { p.processStatuses(context.Background(), nil, nil) })
|
|
}
|