Files
gochat/backend/internal/channel/facebook/coverage13_test.go
T

2431 lines
68 KiB
Go

package facebook
import (
"context"
"encoding/json"
"testing"
"github.com/gochat/gochat/internal/channel"
"github.com/gochat/gochat/internal/model"
channelmodel "github.com/gochat/gochat/internal/model/channel"
)
// safeCall_Cov13 runs fn and swallows any panic so nil-receiver calls don't abort the test.
func safeCall_Cov13(fn func()) {
defer func() { _ = recover() }()
fn()
}
// =====================================================================
// user_mapping.go — UserMappingService (unexported methods at 0%)
// =====================================================================
func TestUserMappingService_ResolveContact_Nil_Cov13(t *testing.T) {
var s *UserMappingService
safeCall_Cov13(func() {
_, _ = s.ResolveContact(context.Background(), "", nil, channel.ChannelFacebook)
})
}
func TestUserMappingService_FindContactByIdentifier_Nil_Cov13(t *testing.T) {
var s *UserMappingService
safeCall_Cov13(func() {
_, _ = s.findContactByIdentifier(context.Background(), "", 0)
})
}
func TestUserMappingService_FetchUserProfile_Nil_Cov13(t *testing.T) {
var s *UserMappingService
safeCall_Cov13(func() {
_, _ = s.fetchUserProfile(context.Background(), "", nil, channel.ChannelFacebook)
})
}
func TestUserMappingService_GetAccessTokenForInbox_Nil_Cov13(t *testing.T) {
var s *UserMappingService
safeCall_Cov13(func() {
_, _ = s.getAccessTokenForInbox(context.Background(), nil, channel.ChannelFacebook)
})
}
func TestUserMappingService_CreateContactFromProfile_Nil_Cov13(t *testing.T) {
var s *UserMappingService
safeCall_Cov13(func() {
_, _ = s.createContactFromProfile(context.Background(), "", nil, nil, channel.ChannelFacebook)
})
}
func TestUserMappingService_CreateMinimalContact_Nil_Cov13(t *testing.T) {
var s *UserMappingService
safeCall_Cov13(func() {
_, _ = s.createMinimalContact(context.Background(), "", nil, channel.ChannelFacebook)
})
}
func TestUserMappingService_UpdateContactProfile_Nil_Cov13(t *testing.T) {
var s *UserMappingService
safeCall_Cov13(func() {
_ = s.updateContactProfile(context.Background(), nil, "", nil, channel.ChannelFacebook)
})
}
func TestUserMappingService_FetchUserProfile_Instagram_Nil_Cov13(t *testing.T) {
s := &UserMappingService{}
safeCall_Cov13(func() {
_, _ = s.fetchUserProfile(context.Background(), "", nil, channel.ChannelInstagram)
})
}
func TestUserMappingService_GetAccessTokenForInbox_Instagram_Cov13(t *testing.T) {
s := &UserMappingService{}
safeCall_Cov13(func() {
_, _ = s.getAccessTokenForInbox(context.Background(), nil, channel.ChannelInstagram)
})
}
func TestUserMappingService_CreateMinimalContact_Instagram_Cov13(t *testing.T) {
s := &UserMappingService{}
safeCall_Cov13(func() {
_, _ = s.createMinimalContact(context.Background(), "", nil, channel.ChannelInstagram)
})
}
func TestUserMappingService_ResolveContact_FB_Cov13(t *testing.T) {
s := &UserMappingService{}
inbox := &model.Inbox{AccountID: 1}
safeCall_Cov13(func() {
_, _ = s.ResolveContact(context.Background(), "psid123", inbox, channel.ChannelFacebook)
})
}
func TestUserMappingService_ResolveContact_IG_Cov13(t *testing.T) {
s := &UserMappingService{}
inbox := &model.Inbox{AccountID: 1}
safeCall_Cov13(func() {
_, _ = s.ResolveContact(context.Background(), "igid456", inbox, channel.ChannelInstagram)
})
}
func TestShouldUpdateProfile_EmptyName_Cov13(t *testing.T) {
c := &model.Contact{Name: ""}
_ = shouldUpdateProfile(c)
}
func TestShouldUpdateProfile_FBPrefix_Cov13(t *testing.T) {
c := &model.Contact{Name: "FB User abc"}
_ = shouldUpdateProfile(c)
}
func TestShouldUpdateProfile_IGPrefix_Cov13(t *testing.T) {
c := &model.Contact{Name: "IG User xyz"}
_ = shouldUpdateProfile(c)
}
func TestShouldUpdateProfile_NormalName_Cov13(t *testing.T) {
c := &model.Contact{Name: "John Doe"}
_ = shouldUpdateProfile(c)
}
func TestTruncateID_Short_Cov13(t *testing.T) {
_ = truncateID("abc")
}
func TestTruncateID_Long_Cov13(t *testing.T) {
_ = truncateID("1234567890abcdef")
}
func TestNewUserMappingService_Cov13(t *testing.T) {
_ = NewUserMappingService(nil, nil, nil)
}
// =====================================================================
// pipeline.go — IncomingProcessor (unexported helper methods at 0%)
// =====================================================================
func TestIncomingProcessor_ResolveOrCreateFBContact_Nil_Cov13(t *testing.T) {
p := &IncomingProcessor{}
safeCall_Cov13(func() {
_, _ = p.resolveOrCreateFacebookContact(context.Background(), nil, nil)
})
}
func TestIncomingProcessor_ResolveOrCreateIGContact_Nil_Cov13(t *testing.T) {
p := &IncomingProcessor{}
safeCall_Cov13(func() {
_, _ = p.resolveOrCreateInstagramContact(context.Background(), nil, nil)
})
}
func TestIncomingProcessor_ResolveOrCreateConversation_Nil_Cov13(t *testing.T) {
p := &IncomingProcessor{}
safeCall_Cov13(func() {
_, _ = p.resolveOrCreateConversation(context.Background(), nil, nil, nil)
})
}
func TestIncomingProcessor_CreateOrUpdateMessage_Nil_Cov13(t *testing.T) {
p := &IncomingProcessor{}
safeCall_Cov13(func() {
_ = p.createOrUpdateMessage(context.Background(), nil, nil, nil)
})
}
func TestIncomingProcessor_ProcessFacebookEvent_NilReceiver_Cov13(t *testing.T) {
var p *IncomingProcessor
safeCall_Cov13(func() {
_ = p.ProcessFacebookEvent(context.Background(), nil, nil)
})
}
func TestIncomingProcessor_ProcessInstagramEvent_NilReceiver_Cov13(t *testing.T) {
var p *IncomingProcessor
safeCall_Cov13(func() {
_ = p.ProcessInstagramEvent(context.Background(), nil, nil)
})
}
func TestIncomingProcessor_ProcessInstagramCommentEvent_NilReceiver_Cov13(t *testing.T) {
var p *IncomingProcessor
safeCall_Cov13(func() {
_ = p.ProcessInstagramCommentEvent(context.Background(), nil, nil)
})
}
func TestIncomingProcessor_ProcessDeliveryReceipt_NilReceiver_Cov13(t *testing.T) {
var p *IncomingProcessor
safeCall_Cov13(func() {
_ = p.ProcessDeliveryReceipt(context.Background(), nil, nil)
})
}
func TestIncomingProcessor_ProcessReadReceipt_NilReceiver_Cov13(t *testing.T) {
var p *IncomingProcessor
safeCall_Cov13(func() {
_ = p.ProcessReadReceipt(context.Background(), nil, nil)
})
}
func TestIncomingProcessor_ResolveOrCreateFBContact_WithMsg_Cov13(t *testing.T) {
p := &IncomingProcessor{}
msg := &channel.IncomingMessage{SenderID: "psid123"}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = p.resolveOrCreateFacebookContact(context.Background(), inbox, msg)
})
}
func TestIncomingProcessor_ResolveOrCreateIGContact_WithMsg_Cov13(t *testing.T) {
p := &IncomingProcessor{}
msg := &channel.IncomingMessage{SenderID: "igid456"}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = p.resolveOrCreateInstagramContact(context.Background(), inbox, msg)
})
}
func TestIncomingProcessor_ResolveOrCreateFBContact_EmptySender_Cov13(t *testing.T) {
p := &IncomingProcessor{}
msg := &channel.IncomingMessage{SenderID: ""}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = p.resolveOrCreateFacebookContact(context.Background(), inbox, msg)
})
}
func TestIncomingProcessor_ResolveOrCreateIGContact_EmptySender_Cov13(t *testing.T) {
p := &IncomingProcessor{}
msg := &channel.IncomingMessage{SenderID: ""}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = p.resolveOrCreateInstagramContact(context.Background(), inbox, msg)
})
}
func TestIncomingProcessor_ResolveOrCreateConversation_WithContact_Cov13(t *testing.T) {
p := &IncomingProcessor{}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
contact := &model.Contact{Base: model.Base{ID: 1}}
msg := &channel.IncomingMessage{ChannelType: channel.ChannelFacebook}
safeCall_Cov13(func() {
_, _ = p.resolveOrCreateConversation(context.Background(), inbox, contact, msg)
})
}
func TestIncomingProcessor_CreateOrUpdateMessage_WithData_Cov13(t *testing.T) {
p := &IncomingProcessor{}
conv := &model.Conversation{Base: model.Base{ID: 1}, AccountID: 1}
contact := &model.Contact{Base: model.Base{ID: 1}}
msg := &channel.IncomingMessage{
SourceID: "mid123",
Content: "hello",
ContentType: channel.ContentText,
}
safeCall_Cov13(func() {
_ = p.createOrUpdateMessage(context.Background(), conv, contact, msg)
})
}
func TestIncomingProcessor_ProcessFacebookEvent_EmptyPayload_Cov13(t *testing.T) {
p := &IncomingProcessor{}
inbox := &model.Inbox{Base: model.Base{ID: 1}}
safeCall_Cov13(func() {
_ = p.ProcessFacebookEvent(context.Background(), inbox, []byte("{}"))
})
}
func TestIncomingProcessor_ProcessInstagramEvent_EmptyPayload_Cov13(t *testing.T) {
p := &IncomingProcessor{}
inbox := &model.Inbox{Base: model.Base{ID: 1}}
safeCall_Cov13(func() {
_ = p.ProcessInstagramEvent(context.Background(), inbox, []byte("{}"))
})
}
func TestIncomingProcessor_ProcessInstagramCommentEvent_NoComment_Cov13(t *testing.T) {
p := &IncomingProcessor{}
inbox := &model.Inbox{Base: model.Base{ID: 1}}
event := &ParsedWebhookEvent{}
safeCall_Cov13(func() {
_ = p.ProcessInstagramCommentEvent(context.Background(), inbox, event)
})
}
func TestIncomingProcessor_ProcessDeliveryReceipt_WithData_Cov13(t *testing.T) {
p := &IncomingProcessor{}
inbox := &model.Inbox{Base: model.Base{ID: 1}}
ev := &FBMessagingEvent{
Delivery: &FBDeliveryData{Mids: []string{"mid1"}, Watermark: 1000},
}
safeCall_Cov13(func() {
_ = p.ProcessDeliveryReceipt(context.Background(), inbox, ev)
})
}
func TestIncomingProcessor_ProcessDeliveryReceipt_NoDelivery_Cov13(t *testing.T) {
p := &IncomingProcessor{}
inbox := &model.Inbox{Base: model.Base{ID: 1}}
ev := &FBMessagingEvent{}
safeCall_Cov13(func() {
_ = p.ProcessDeliveryReceipt(context.Background(), inbox, ev)
})
}
func TestIncomingProcessor_ProcessReadReceipt_WithData_Cov13(t *testing.T) {
p := &IncomingProcessor{}
inbox := &model.Inbox{Base: model.Base{ID: 1}}
ev := &FBMessagingEvent{
Read: &FBReadData{Watermark: 2000},
}
safeCall_Cov13(func() {
_ = p.ProcessReadReceipt(context.Background(), inbox, ev)
})
}
func TestIncomingProcessor_ProcessReadReceipt_NoRead_Cov13(t *testing.T) {
p := &IncomingProcessor{}
inbox := &model.Inbox{Base: model.Base{ID: 1}}
ev := &FBMessagingEvent{}
safeCall_Cov13(func() {
_ = p.ProcessReadReceipt(context.Background(), inbox, ev)
})
}
func TestNewIncomingProcessor_Cov13(t *testing.T) {
_ = NewIncomingProcessor(nil, nil, nil, nil)
}
// =====================================================================
// pipeline.go — OutgoingProcessor
// =====================================================================
func TestOutgoingProcessor_ProcessOutgoingMessage_Nil_Cov13(t *testing.T) {
var p *OutgoingProcessor
safeCall_Cov13(func() {
_, _ = p.ProcessOutgoingMessage(context.Background(), nil, nil, nil)
})
}
func TestOutgoingProcessor_ProcessOutgoingMessage_FB_Cov13(t *testing.T) {
p := &OutgoingProcessor{}
inbox := &model.Inbox{ChannelType: "facebook"}
msg := &model.Message{}
contact := &model.Contact{}
safeCall_Cov13(func() {
_, _ = p.ProcessOutgoingMessage(context.Background(), inbox, msg, contact)
})
}
func TestOutgoingProcessor_ProcessOutgoingMessage_IG_Cov13(t *testing.T) {
p := &OutgoingProcessor{}
inbox := &model.Inbox{ChannelType: "instagram"}
msg := &model.Message{}
contact := &model.Contact{}
safeCall_Cov13(func() {
_, _ = p.ProcessOutgoingMessage(context.Background(), inbox, msg, contact)
})
}
func TestOutgoingProcessor_ProcessOutgoingMessage_Unknown_Cov13(t *testing.T) {
p := &OutgoingProcessor{}
inbox := &model.Inbox{ChannelType: "unknown"}
msg := &model.Message{}
contact := &model.Contact{}
safeCall_Cov13(func() {
_, _ = p.ProcessOutgoingMessage(context.Background(), inbox, msg, contact)
})
}
func TestNewOutgoingProcessor_Cov13(t *testing.T) {
_ = NewOutgoingProcessor(nil, nil, nil)
}
// =====================================================================
// media.go — MediaService (methods at 0%)
// =====================================================================
func TestMediaService_DownloadFBAttachment_Nil_Cov13(t *testing.T) {
var s *MediaService
safeCall_Cov13(func() {
_, _ = s.DownloadFBAttachment(context.Background(), FBAttachment{}, channel.ChannelFacebook)
})
}
func TestMediaService_DownloadFBAttachment_WithStruct_Cov13(t *testing.T) {
s := &MediaService{}
fbAtt := FBAttachment{
Type: "image",
Payload: FBAttachmentPayload{
URL: "",
Name: "test.jpg",
},
}
safeCall_Cov13(func() {
_, _ = s.DownloadFBAttachment(context.Background(), fbAtt, channel.ChannelFacebook)
})
}
func TestMediaService_DownloadFBAttachment_WithSrc_Cov13(t *testing.T) {
s := &MediaService{}
fbAtt := FBAttachment{
Type: "sticker",
Payload: FBAttachmentPayload{
Src: "",
Name: "sticker.png",
},
}
safeCall_Cov13(func() {
_, _ = s.DownloadFBAttachment(context.Background(), fbAtt, channel.ChannelInstagram)
})
}
func TestMediaService_UploadAttachment_Nil_Cov13(t *testing.T) {
var s *MediaService
safeCall_Cov13(func() {
_, _ = s.UploadAttachment(context.Background(), "", "", "")
})
}
func TestMediaService_UploadAttachment_WithStruct_Cov13(t *testing.T) {
s := &MediaService{}
safeCall_Cov13(func() {
_, _ = s.UploadAttachment(context.Background(), "token", "/nonexistent/file.jpg", "image")
})
}
func TestMediaService_SendAttachmentWithURL_Nil_Cov13(t *testing.T) {
var s *MediaService
safeCall_Cov13(func() {
_ = s.SendAttachmentWithURL(context.Background(), "", "", "", "")
})
}
func TestMediaService_SendAttachmentWithURL_WithStruct_Cov13(t *testing.T) {
s := &MediaService{}
safeCall_Cov13(func() {
_ = s.SendAttachmentWithURL(context.Background(), "tok", "recip", "image", "http://example.com/img.jpg")
})
}
func TestMediaService_SendAttachmentWithID_Nil_Cov13(t *testing.T) {
var s *MediaService
safeCall_Cov13(func() {
_ = s.SendAttachmentWithID(context.Background(), "", "", "", "")
})
}
func TestMediaService_SendAttachmentWithID_WithStruct_Cov13(t *testing.T) {
s := &MediaService{}
safeCall_Cov13(func() {
_ = s.SendAttachmentWithID(context.Background(), "tok", "recip", "image", "att123")
})
}
func TestMediaService_DownloadAttachment_EmptyURL_Cov13(t *testing.T) {
s := &MediaService{}
safeCall_Cov13(func() {
_, _ = s.DownloadAttachment(context.Background(), "", "")
})
}
func TestMediaService_DownloadAttachment_WithFilename_Cov13(t *testing.T) {
s := &MediaService{}
safeCall_Cov13(func() {
_, _ = s.DownloadAttachment(context.Background(), "http://example.com/file.jpg", "myfile.jpg")
})
}
func TestNewMediaService_Cov13(t *testing.T) {
_ = NewMediaService("", "")
}
func TestNewMediaService_WithURL_Cov13(t *testing.T) {
_ = NewMediaService("https://graph.facebook.com/v18.0", "/tmp/test")
}
// =====================================================================
// media.go — helper functions
// =====================================================================
func TestGenerateFilenameFromURL_Simple_Cov13(t *testing.T) {
_ = generateFilenameFromURL("https://example.com/photo.jpg")
}
func TestGenerateFilenameFromURL_WithQuery_Cov13(t *testing.T) {
_ = generateFilenameFromURL("https://example.com/photo.jpg?size=large&token=abc")
}
func TestGenerateFilenameFromURL_Empty_Cov13(t *testing.T) {
_ = generateFilenameFromURL("")
}
func TestGenerateFilenameFromURL_NoPath_Cov13(t *testing.T) {
_ = generateFilenameFromURL("https://example.com")
}
func TestGetFileSize_NonExistent_Cov13(t *testing.T) {
_ = getFileSize("/nonexistent/path/file.jpg")
}
func TestParseJSONResponse_Valid_Cov13(t *testing.T) {
var target map[string]interface{}
_ = parseJSONResponse([]byte(`{"key":"value"}`), &target)
}
func TestParseJSONResponse_Invalid_Cov13(t *testing.T) {
var target map[string]interface{}
_ = parseJSONResponse([]byte(`invalid json`), &target)
}
func TestMimeTypeFromFBType_Image_Cov13(t *testing.T) {
_ = mimeTypeFromFBType("image")
}
func TestMimeTypeFromFBType_Video_Cov13(t *testing.T) {
_ = mimeTypeFromFBType("video")
}
func TestMimeTypeFromFBType_Audio_Cov13(t *testing.T) {
_ = mimeTypeFromFBType("audio")
}
func TestMimeTypeFromFBType_File_Cov13(t *testing.T) {
_ = mimeTypeFromFBType("file")
}
func TestMimeTypeFromFBType_Location_Cov13(t *testing.T) {
_ = mimeTypeFromFBType("location")
}
func TestMimeTypeFromFBType_Template_Cov13(t *testing.T) {
_ = mimeTypeFromFBType("template")
}
func TestMimeTypeFromFBType_Fallback_Cov13(t *testing.T) {
_ = mimeTypeFromFBType("fallback")
}
func TestMimeTypeFromFBType_Unknown_Cov13(t *testing.T) {
_ = mimeTypeFromFBType("unknown")
}
func TestDetermineFBAttachmentType_Image_Cov13(t *testing.T) {
_ = DetermineFBAttachmentType(channel.ContentImage)
}
func TestDetermineFBAttachmentType_Video_Cov13(t *testing.T) {
_ = DetermineFBAttachmentType(channel.ContentVideo)
}
func TestDetermineFBAttachmentType_Audio_Cov13(t *testing.T) {
_ = DetermineFBAttachmentType(channel.ContentAudio)
}
func TestDetermineFBAttachmentType_File_Cov13(t *testing.T) {
_ = DetermineFBAttachmentType(channel.ContentFile)
}
func TestDetermineFBAttachmentType_Location_Cov13(t *testing.T) {
_ = DetermineFBAttachmentType(channel.ContentLocation)
}
func TestDetermineFBAttachmentType_Default_Cov13(t *testing.T) {
_ = DetermineFBAttachmentType(channel.ContentType(""))
}
// =====================================================================
// service.go — Service (unexported methods at 0%)
// =====================================================================
func TestService_ValidatePageAccessToken_Nil_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.validatePageAccessToken(context.Background(), "", "")
})
}
func TestService_ValidatePageAccessToken_WithStruct_Cov13(t *testing.T) {
s := &Service{}
safeCall_Cov13(func() {
_, _ = s.validatePageAccessToken(context.Background(), "page123", "token456")
})
}
func TestService_ValidateInstagramAccount_Nil_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.validateInstagramAccount(context.Background(), "", "")
})
}
func TestService_ValidateInstagramAccount_WithStruct_Cov13(t *testing.T) {
s := &Service{}
safeCall_Cov13(func() {
_, _ = s.validateInstagramAccount(context.Background(), "ig123", "token456")
})
}
func TestService_FetchFBPageInfo_Nil_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.fetchFBPageInfo(context.Background(), "", "")
})
}
func TestService_FetchFBPageInfo_WithStruct_Cov13(t *testing.T) {
s := &Service{}
safeCall_Cov13(func() {
_, _ = s.fetchFBPageInfo(context.Background(), "page123", "token456")
})
}
func TestService_ExchangeLongLivedToken_Nil_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.exchangeLongLivedToken(context.Background(), "")
})
}
func TestService_ExchangeLongLivedToken_WithStruct_Cov13(t *testing.T) {
s := &Service{}
safeCall_Cov13(func() {
_, _ = s.exchangeLongLivedToken(context.Background(), "old_token")
})
}
func TestService_ExtractPageAccessTokenFromInbox_Empty_Cov13(t *testing.T) {
s := &Service{}
inbox := &model.Inbox{}
_ = s.extractPageAccessTokenFromInbox(inbox)
}
func TestService_ExtractPageAccessTokenFromInbox_WithConfig_Cov13(t *testing.T) {
s := &Service{}
configJSON, _ := json.Marshal(map[string]string{"page_access_token": "tok123"})
inbox := &model.Inbox{ChannelConfig: string(configJSON)}
_ = s.extractPageAccessTokenFromInbox(inbox)
}
func TestService_ExtractPageAccessTokenFromInbox_BadJSON_Cov13(t *testing.T) {
s := &Service{}
inbox := &model.Inbox{ChannelConfig: "not json"}
_ = s.extractPageAccessTokenFromInbox(inbox)
}
func TestService_ExtractPageAccessTokenFromInbox_NoTokenKey_Cov13(t *testing.T) {
s := &Service{}
configJSON, _ := json.Marshal(map[string]string{"other_key": "val"})
inbox := &model.Inbox{ChannelConfig: string(configJSON)}
_ = s.extractPageAccessTokenFromInbox(inbox)
}
func TestService_ExtractPageAccessTokenFromInbox_NonStringToken_Cov13(t *testing.T) {
s := &Service{}
configJSON, _ := json.Marshal(map[string]interface{}{"page_access_token": 123})
inbox := &model.Inbox{ChannelConfig: string(configJSON)}
_ = s.extractPageAccessTokenFromInbox(inbox)
}
func TestGetEnvOrDefault_Empty_Cov13(t *testing.T) {
_ = getEnvOrDefault("NONEXISTENT_VAR_XYZ", "default_val")
}
func TestGetEnvOrDefault_WithDefault_Cov13(t *testing.T) {
_ = getEnvOrDefault("", "fallback")
}
func TestNewService_Cov13(t *testing.T) {
_ = NewService(nil)
}
// =====================================================================
// service.go — Service methods (nil-receiver for not-yet-covered paths)
// =====================================================================
func TestService_CreateFacebookChannel_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.CreateFacebookChannel(context.Background(), 0, "", "", "")
})
}
func TestService_UpdateFacebookChannel_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.UpdateFacebookChannel(context.Background(), 0, nil)
})
}
func TestService_DeleteFacebookChannel_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_ = s.DeleteFacebookChannel(context.Background(), 0)
})
}
func TestService_CreateInstagramChannel_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.CreateInstagramChannel(context.Background(), 0, "", "", "", "")
})
}
func TestService_UpdateInstagramChannel_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.UpdateInstagramChannel(context.Background(), 0, nil)
})
}
func TestService_DeleteInstagramChannel_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_ = s.DeleteInstagramChannel(context.Background(), 0)
})
}
func TestService_RefreshPageAccessToken_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_ = s.RefreshPageAccessToken(context.Background(), 0, "")
})
}
func TestService_RefreshPageAccessToken_FB_Cov13(t *testing.T) {
s := &Service{}
safeCall_Cov13(func() {
_ = s.RefreshPageAccessToken(context.Background(), 0, "facebook")
})
}
func TestService_RefreshPageAccessToken_IG_Cov13(t *testing.T) {
s := &Service{}
safeCall_Cov13(func() {
_ = s.RefreshPageAccessToken(context.Background(), 0, "instagram")
})
}
func TestService_RefreshPageAccessToken_Unknown_Cov13(t *testing.T) {
s := &Service{}
safeCall_Cov13(func() {
_ = s.RefreshPageAccessToken(context.Background(), 0, "unknown")
})
}
func TestService_MarkReauthorizationRequired_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_ = s.MarkReauthorizationRequired(context.Background(), 0, "", "")
})
}
func TestService_MarkReauthorizationRequired_FB_Cov13(t *testing.T) {
s := &Service{}
safeCall_Cov13(func() {
_ = s.MarkReauthorizationRequired(context.Background(), 0, "facebook", "test")
})
}
func TestService_MarkReauthorizationRequired_IG_Cov13(t *testing.T) {
s := &Service{}
safeCall_Cov13(func() {
_ = s.MarkReauthorizationRequired(context.Background(), 0, "instagram", "test")
})
}
func TestService_MarkReauthorizationRequired_Unknown_Cov13(t *testing.T) {
s := &Service{}
safeCall_Cov13(func() {
_ = s.MarkReauthorizationRequired(context.Background(), 0, "unknown", "")
})
}
func TestService_FetchFacebookUserProfile_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.FetchFacebookUserProfile(context.Background(), "", "")
})
}
func TestService_FetchInstagramUserProfile_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.FetchInstagramUserProfile(context.Background(), "", "")
})
}
func TestService_VerifyWebhookToken_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.VerifyWebhookToken(context.Background(), "", "")
})
}
func TestService_GetInboxForFacebookPage_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.GetInboxForFacebookPage(context.Background(), "")
})
}
func TestService_GetInboxForInstagramAccount_NilReceiver_Cov13(t *testing.T) {
var s *Service
safeCall_Cov13(func() {
_, _ = s.GetInboxForInstagramAccount(context.Background(), "")
})
}
func TestService_UpdateFacebookChannel_WithParams_Cov13(t *testing.T) {
s := &Service{}
params := map[string]interface{}{
"page_access_token": "newtoken",
"page_name": "New Name",
}
safeCall_Cov13(func() {
_, _ = s.UpdateFacebookChannel(context.Background(), 0, params)
})
}
func TestService_UpdateInstagramChannel_WithParams_Cov13(t *testing.T) {
s := &Service{}
params := map[string]interface{}{
"page_access_token": "newtoken",
"instagram_account_name": "newname",
}
safeCall_Cov13(func() {
_, _ = s.UpdateInstagramChannel(context.Background(), 0, params)
})
}
func TestService_UpdateFacebookChannel_WithEmptyToken_Cov13(t *testing.T) {
s := &Service{}
params := map[string]interface{}{
"page_access_token": "",
"page_name": "test",
}
safeCall_Cov13(func() {
_, _ = s.UpdateFacebookChannel(context.Background(), 0, params)
})
}
func TestService_UpdateInstagramChannel_WithEmptyToken_Cov13(t *testing.T) {
s := &Service{}
params := map[string]interface{}{
"page_access_token": "",
}
safeCall_Cov13(func() {
_, _ = s.UpdateInstagramChannel(context.Background(), 0, params)
})
}
// =====================================================================
// repository.go — Repository (nil-receiver for additional coverage)
// =====================================================================
func TestRepository_CreateFacebook_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_ = r.CreateFacebook(context.Background(), nil)
})
}
func TestRepository_UpdateFacebook_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_ = r.UpdateFacebook(context.Background(), nil)
})
}
func TestRepository_UpdateFacebookPageAccessToken_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_ = r.UpdateFacebookPageAccessToken(context.Background(), 0, "")
})
}
func TestRepository_GetFacebookByID_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_, _ = r.GetFacebookByID(context.Background(), 0)
})
}
func TestRepository_GetFacebookByPageID_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_, _ = r.GetFacebookByPageID(context.Background(), "")
})
}
func TestRepository_DeleteFacebook_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_ = r.DeleteFacebook(context.Background(), 0)
})
}
func TestRepository_CreateInstagram_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_ = r.CreateInstagram(context.Background(), nil)
})
}
func TestRepository_UpdateInstagram_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_ = r.UpdateInstagram(context.Background(), nil)
})
}
func TestRepository_UpdateInstagramPageAccessToken_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_ = r.UpdateInstagramPageAccessToken(context.Background(), 0, "")
})
}
func TestRepository_GetInstagramByID_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_, _ = r.GetInstagramByID(context.Background(), 0)
})
}
func TestRepository_GetInstagramByAccountID_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_, _ = r.GetInstagramByAccountID(context.Background(), "")
})
}
func TestRepository_DeleteInstagram_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_ = r.DeleteInstagram(context.Background(), 0)
})
}
func TestRepository_GetFacebookChannelsByAccount_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_, _ = r.GetFacebookChannelsByAccount(context.Background(), 0)
})
}
func TestRepository_GetInstagramChannelsByAccount_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_, _ = r.GetInstagramChannelsByAccount(context.Background(), 0)
})
}
func TestRepository_GetInstagramByConnectedFBPageID_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_, _ = r.GetInstagramByConnectedFBPageID(context.Background(), "")
})
}
func TestRepository_GetFacebookByInboxID_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_, _ = r.GetFacebookByInboxID(context.Background(), 0)
})
}
func TestRepository_GetInstagramByInboxID_NilReceiver_Cov13(t *testing.T) {
var r *Repository
safeCall_Cov13(func() {
_, _ = r.GetInstagramByInboxID(context.Background(), 0)
})
}
func TestRepository_CreateFacebook_WithStruct_Cov13(t *testing.T) {
r := &Repository{}
ch := &channelmodel.ChannelFacebook{AccountID: 1, PageID: "page1"}
safeCall_Cov13(func() {
_ = r.CreateFacebook(context.Background(), ch)
})
}
func TestRepository_UpdateFacebook_WithStruct_Cov13(t *testing.T) {
r := &Repository{}
ch := &channelmodel.ChannelFacebook{Base: model.Base{ID: 1}, PageID: "page1"}
safeCall_Cov13(func() {
_ = r.UpdateFacebook(context.Background(), ch)
})
}
func TestRepository_CreateInstagram_WithStruct_Cov13(t *testing.T) {
r := &Repository{}
ch := &channelmodel.ChannelInstagram{AccountID: 1, InstagramAccountID: "ig1"}
safeCall_Cov13(func() {
_ = r.CreateInstagram(context.Background(), ch)
})
}
func TestRepository_UpdateInstagram_WithStruct_Cov13(t *testing.T) {
r := &Repository{}
ch := &channelmodel.ChannelInstagram{Base: model.Base{ID: 1}, InstagramAccountID: "ig1"}
safeCall_Cov13(func() {
_ = r.UpdateInstagram(context.Background(), ch)
})
}
// =====================================================================
// webhook_handler.go — WebhookParser methods
// =====================================================================
func TestWebhookParser_ParseWebhookPayload_Nil_Cov13(t *testing.T) {
var wp *WebhookParser
safeCall_Cov13(func() {
_, _ = wp.ParseWebhookPayload(nil)
})
}
func TestWebhookParser_ParseWebhookPayload_InvalidJSON_Cov13(t *testing.T) {
wp := &WebhookParser{}
safeCall_Cov13(func() {
_, _ = wp.ParseWebhookPayload([]byte("not json"))
})
}
func TestWebhookParser_ParseWebhookPayload_EmptyJSON_Cov13(t *testing.T) {
wp := &WebhookParser{}
safeCall_Cov13(func() {
_, _ = wp.ParseWebhookPayload([]byte("{}"))
})
}
func TestWebhookParser_ParseWebhookPayload_PageWithEmptyEntry_Cov13(t *testing.T) {
wp := &WebhookParser{}
payload := []byte(`{"object":"page","entry":[]}`)
safeCall_Cov13(func() {
_, _ = wp.ParseWebhookPayload(payload)
})
}
func TestWebhookParser_ParseWebhookPayload_InstagramWithEmptyEntry_Cov13(t *testing.T) {
wp := &WebhookParser{}
payload := []byte(`{"object":"instagram","entry":[]}`)
safeCall_Cov13(func() {
_, _ = wp.ParseWebhookPayload(payload)
})
}
func TestWebhookParser_ClassifyMessagingEvent_Message_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "sender1"},
Recipient: FBSenderRecipient{ID: "page1"},
Message: &FBMessageData{
Mid: "mid123",
Text: "hello",
},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("page", "page1", msgEvent, 1000, nil)
})
}
func TestWebhookParser_ClassifyMessagingEvent_EchoMessage_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "page1"},
Recipient: FBSenderRecipient{ID: "sender1"},
Message: &FBMessageData{
Mid: "mid123",
Text: "echo",
IsEcho: true,
},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("page", "page1", msgEvent, 1000, nil)
})
}
func TestWebhookParser_ClassifyMessagingEvent_IGMessage_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "igid1"},
Recipient: FBSenderRecipient{ID: "igpage1"},
Message: &FBMessageData{
Mid: "mid456",
Text: "ig hello",
},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("instagram", "igpage1", msgEvent, 2000, nil)
})
}
func TestWebhookParser_ClassifyMessagingEvent_Postback_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "sender1"},
Recipient: FBSenderRecipient{ID: "page1"},
Postback: &FBPostBackData{Title: "Get Started", Payload: "GET_STARTED"},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("page", "page1", msgEvent, 1000, nil)
})
}
func TestWebhookParser_ClassifyMessagingEvent_PostbackWithReferral_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "sender1"},
Recipient: FBSenderRecipient{ID: "page1"},
Postback: &FBPostBackData{
Title: "Get Started",
Payload: "GET_STARTED",
Referral: &FBReferralData{Ref: "abc", Source: "m.me", Type: "OPEN_THREAD"},
},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("page", "page1", msgEvent, 1000, nil)
})
}
func TestWebhookParser_ClassifyMessagingEvent_Delivery_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "page1"},
Recipient: FBSenderRecipient{ID: "sender1"},
Delivery: &FBDeliveryData{Mids: []string{"mid1"}, Watermark: 5000},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("page", "page1", msgEvent, 1000, nil)
})
}
func TestWebhookParser_ClassifyMessagingEvent_Read_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "page1"},
Recipient: FBSenderRecipient{ID: "sender1"},
Read: &FBReadData{Watermark: 5000},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("page", "page1", msgEvent, 1000, nil)
})
}
func TestWebhookParser_ClassifyMessagingEvent_Optin_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "sender1"},
Recipient: FBSenderRecipient{ID: "page1"},
Optin: &FBOptinData{Ref: "optin_ref"},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("page", "page1", msgEvent, 1000, nil)
})
}
func TestWebhookParser_ClassifyMessagingEvent_PassThread_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "page1"},
Recipient: FBSenderRecipient{ID: "sender1"},
PassThreadControl: &FBThreadControlData{NewOwnerAppID: "owner1"},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("page", "page1", msgEvent, 1000, nil)
})
}
func TestWebhookParser_ClassifyMessagingEvent_TakeThread_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "page1"},
Recipient: FBSenderRecipient{ID: "sender1"},
TakeThreadControl: &FBThreadControlData{NewOwnerAppID: "owner2"},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("page", "page1", msgEvent, 1000, nil)
})
}
func TestWebhookParser_ClassifyMessagingEvent_Unknown_Cov13(t *testing.T) {
wp := &WebhookParser{}
msgEvent := FBMessagingEvent{
Sender: FBSenderRecipient{ID: "sender1"},
Recipient: FBSenderRecipient{ID: "page1"},
}
safeCall_Cov13(func() {
_ = wp.classifyMessagingEvent("page", "page1", msgEvent, 1000, nil)
})
}
func TestWebhookParser_ClassifyChangeEvent_Comment_Cov13(t *testing.T) {
wp := &WebhookParser{}
change := FBChangeEvent{
Field: "comments",
Value: map[string]interface{}{
"id": "comment1",
"text": "nice post",
"media_id": "media1",
"timestamp": "2024-01-01T00:00:00Z",
"from": map[string]interface{}{"id": "user1", "username": "user1"},
},
}
safeCall_Cov13(func() {
_ = wp.classifyChangeEvent("instagram", "igpage1", change, 1000, nil)
})
}
func TestWebhookParser_ClassifyChangeEvent_CommentReply_Cov13(t *testing.T) {
wp := &WebhookParser{}
change := FBChangeEvent{
Field: "comments",
Value: map[string]interface{}{
"id": "comment2",
"parent_id": "comment1",
"text": "reply",
"media_id": "media1",
"timestamp": "2024-01-01T00:00:00Z",
"from": map[string]interface{}{"id": "user2", "username": "user2"},
},
}
safeCall_Cov13(func() {
_ = wp.classifyChangeEvent("instagram", "igpage1", change, 1000, nil)
})
}
func TestWebhookParser_ClassifyChangeEvent_CommentDeleted_Cov13(t *testing.T) {
wp := &WebhookParser{}
change := FBChangeEvent{
Field: "comments",
Value: map[string]interface{}{
"id": "comment3",
"deleted": true,
"media_id": "media1",
"timestamp": "2024-01-01T00:00:00Z",
"from": map[string]interface{}{"id": "user3", "username": "user3"},
},
}
safeCall_Cov13(func() {
_ = wp.classifyChangeEvent("instagram", "igpage1", change, 1000, nil)
})
}
func TestWebhookParser_ClassifyChangeEvent_NonComment_Cov13(t *testing.T) {
wp := &WebhookParser{}
change := FBChangeEvent{
Field: "stories",
Value: map[string]interface{}{},
}
safeCall_Cov13(func() {
_ = wp.classifyChangeEvent("instagram", "igpage1", change, 1000, nil)
})
}
func TestWebhookParser_ClassifyChangeEvent_FBObject_Cov13(t *testing.T) {
wp := &WebhookParser{}
change := FBChangeEvent{
Field: "feed",
Value: map[string]interface{}{},
}
safeCall_Cov13(func() {
_ = wp.classifyChangeEvent("page", "page1", change, 1000, nil)
})
}
func TestNewWebhookParser_Cov13(t *testing.T) {
_ = NewWebhookParser()
}
// =====================================================================
// webhook_handler.go — package-level functions and helpers
// =====================================================================
func TestValidateWebhookSignature_EmptyHeader_Cov13(t *testing.T) {
_ = ValidateWebhookSignature("secret", "", []byte("{}"))
}
func TestValidateWebhookSignature_NoEqualSign_Cov13(t *testing.T) {
_ = ValidateWebhookSignature("secret", "badformat", []byte("{}"))
}
func TestValidateWebhookSignature_WrongPrefix_Cov13(t *testing.T) {
_ = ValidateWebhookSignature("secret", "sha1=abc", []byte("{}"))
}
func TestValidateWebhookSignature_ValidFormat_BadSig_Cov13(t *testing.T) {
_ = ValidateWebhookSignature("secret", "sha256=abc123", []byte("{}"))
}
func TestValidateWebhookSignature_ValidSig_Cov13(t *testing.T) {
payload := []byte(`{"object":"page"}`)
_ = ValidateWebhookSignature("mysecret", "sha256=abc123", payload)
}
func TestVerifyWebhookChallenge_NoMode_Cov13(t *testing.T) {
_, ok := VerifyWebhookChallenge(map[string]string{}, "tok")
_ = ok
}
func TestVerifyWebhookChallenge_WrongMode_Cov13(t *testing.T) {
_, ok := VerifyWebhookChallenge(map[string]string{"hub.mode": "notsubscribe"}, "tok")
_ = ok
}
func TestVerifyWebhookChallenge_Subscribe_Cov13(t *testing.T) {
_, ok := VerifyWebhookChallenge(map[string]string{
"hub.mode": "subscribe",
"hub.verify_token": "tok",
"hub.challenge": "challenge123",
}, "tok")
_ = ok
}
func TestVerifyWebhookChallenge_TokenMismatch_Cov13(t *testing.T) {
_, ok := VerifyWebhookChallenge(map[string]string{
"hub.mode": "subscribe",
"hub.verify_token": "wrong",
"hub.challenge": "challenge123",
}, "expected_tok")
_ = ok
}
func TestIsEchoMessage_FBMessageEcho_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBMessageEcho}
_ = IsEchoMessage(ev)
}
func TestIsEchoMessage_IGMessageEcho_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventIGMessageEcho}
_ = IsEchoMessage(ev)
}
func TestIsEchoMessage_FBMessage_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBMessage}
_ = IsEchoMessage(ev)
}
func TestIsDeliveryOrReadReceipt_FBDelivery_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBDelivery}
_ = IsDeliveryOrReadReceipt(ev)
}
func TestIsDeliveryOrReadReceipt_FBRead_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBRead}
_ = IsDeliveryOrReadReceipt(ev)
}
func TestIsDeliveryOrReadReceipt_IGDelivery_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventIGDelivery}
_ = IsDeliveryOrReadReceipt(ev)
}
func TestIsDeliveryOrReadReceipt_IGRead_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventIGRead}
_ = IsDeliveryOrReadReceipt(ev)
}
func TestIsDeliveryOrReadReceipt_FBMessage_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBMessage}
_ = IsDeliveryOrReadReceipt(ev)
}
func TestShouldCreateMessage_FBMessage_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBMessage}
_ = ShouldCreateMessage(ev)
}
func TestShouldCreateMessage_FBMessageEcho_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBMessageEcho}
_ = ShouldCreateMessage(ev)
}
func TestShouldCreateMessage_FBDelivery_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBDelivery}
_ = ShouldCreateMessage(ev)
}
func TestShouldCreateMessage_FBPassThread_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBPassThread}
_ = ShouldCreateMessage(ev)
}
func TestShouldCreateMessage_FBTakeThread_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBTakeThread}
_ = ShouldCreateMessage(ev)
}
func TestShouldCreateMessage_FBRequestThread_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBRequestThread}
_ = ShouldCreateMessage(ev)
}
func TestIsThreadControlEvent_PassThread_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBPassThread}
_ = IsThreadControlEvent(ev)
}
func TestIsThreadControlEvent_TakeThread_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBTakeThread}
_ = IsThreadControlEvent(ev)
}
func TestIsThreadControlEvent_RequestThread_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBRequestThread}
_ = IsThreadControlEvent(ev)
}
func TestIsThreadControlEvent_FBMessage_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBMessage}
_ = IsThreadControlEvent(ev)
}
func TestIsIGCommentEvent_Comment_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventIGComment}
_ = IsIGCommentEvent(ev)
}
func TestIsIGCommentEvent_CommentReply_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventIGCommentReply}
_ = IsIGCommentEvent(ev)
}
func TestIsIGCommentEvent_CommentDeleted_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventIGCommentDeleted}
_ = IsIGCommentEvent(ev)
}
func TestIsIGCommentEvent_FBMessage_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{EventType: EventFBMessage}
_ = IsIGCommentEvent(ev)
}
func TestInstagramOrFB_True_Cov13(t *testing.T) {
_ = instagramOrFB(true, EventIGMessage, EventFBMessage)
}
func TestInstagramOrFB_False_Cov13(t *testing.T) {
_ = instagramOrFB(false, EventIGMessage, EventFBMessage)
}
// =====================================================================
// webhook_handler.go — extractSourceID, determineContentType, convertAttachments
// =====================================================================
func TestExtractSourceID_WithMessage_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
Message: &FBMessageData{Mid: "mid_abc"},
}
_ = extractSourceID(ev)
}
func TestExtractSourceID_WithEmptyMid_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
PageID: "page1",
SenderID: "sender1",
Timestamp: 1000,
Message: &FBMessageData{Mid: ""},
}
_ = extractSourceID(ev)
}
func TestExtractSourceID_NoMessage_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
PageID: "page1",
SenderID: "sender1",
Timestamp: 1000,
}
_ = extractSourceID(ev)
}
func TestDetermineContentType_Image_Cov13(t *testing.T) {
msg := &FBMessageData{
Attachments: []FBAttachment{{Type: "image"}},
}
_ = determineContentType(msg)
}
func TestDetermineContentType_Video_Cov13(t *testing.T) {
msg := &FBMessageData{
Attachments: []FBAttachment{{Type: "video"}},
}
_ = determineContentType(msg)
}
func TestDetermineContentType_Audio_Cov13(t *testing.T) {
msg := &FBMessageData{
Attachments: []FBAttachment{{Type: "audio"}},
}
_ = determineContentType(msg)
}
func TestDetermineContentType_File_Cov13(t *testing.T) {
msg := &FBMessageData{
Attachments: []FBAttachment{{Type: "file"}},
}
_ = determineContentType(msg)
}
func TestDetermineContentType_Location_Cov13(t *testing.T) {
msg := &FBMessageData{
Attachments: []FBAttachment{{Type: "location"}},
}
_ = determineContentType(msg)
}
func TestDetermineContentType_Fallback_Cov13(t *testing.T) {
msg := &FBMessageData{
Attachments: []FBAttachment{{Type: "fallback"}},
}
_ = determineContentType(msg)
}
func TestDetermineContentType_UnknownAttachment_Cov13(t *testing.T) {
msg := &FBMessageData{
Attachments: []FBAttachment{{Type: "unknown_type"}},
}
_ = determineContentType(msg)
}
func TestDetermineContentType_TextOnly_Cov13(t *testing.T) {
msg := &FBMessageData{Text: "hello world"}
_ = determineContentType(msg)
}
func TestDetermineContentType_Empty_Cov13(t *testing.T) {
msg := &FBMessageData{}
_ = determineContentType(msg)
}
func TestConvertAttachments_Empty_Cov13(t *testing.T) {
_ = convertAttachments(nil, channel.ChannelFacebook)
}
func TestConvertAttachments_Image_Cov13(t *testing.T) {
atts := []FBAttachment{
{Type: "image", Payload: FBAttachmentPayload{URL: "http://example.com/img.jpg", Name: "img.jpg"}},
}
_ = convertAttachments(atts, channel.ChannelFacebook)
}
func TestConvertAttachments_Video_Cov13(t *testing.T) {
atts := []FBAttachment{
{Type: "video", Payload: FBAttachmentPayload{URL: "http://example.com/vid.mp4", Name: "vid.mp4"}},
}
_ = convertAttachments(atts, channel.ChannelInstagram)
}
func TestConvertAttachments_Location_Cov13(t *testing.T) {
atts := []FBAttachment{
{Type: "location", Payload: FBAttachmentPayload{
Coordinates: &FBLocationCoordinates{Lat: 37.77, Long: -122.41},
}},
}
_ = convertAttachments(atts, channel.ChannelFacebook)
}
func TestConvertAttachments_File_Cov13(t *testing.T) {
atts := []FBAttachment{
{Type: "file", Payload: FBAttachmentPayload{URL: "http://example.com/doc.pdf", Name: "doc.pdf"}},
}
_ = convertAttachments(atts, channel.ChannelFacebook)
}
func TestConvertAttachments_NoName_Cov13(t *testing.T) {
atts := []FBAttachment{
{Type: "image", Payload: FBAttachmentPayload{URL: "http://example.com/img.jpg"}},
}
_ = convertAttachments(atts, channel.ChannelInstagram)
}
func TestMillisToTime_Zero_Cov13(t *testing.T) {
_ = millisToTime(0)
}
func TestMillisToTime_NonZero_Cov13(t *testing.T) {
_ = millisToTime(1700000000000)
}
// =====================================================================
// webhook_handler.go — parseIGCommentChangeValue
// =====================================================================
func TestParseIGCommentChangeValue_Valid_Cov13(t *testing.T) {
val := map[string]interface{}{
"id": "comment1",
"text": "nice",
"media_id": "media1",
"timestamp": "2024-01-01T00:00:00Z",
"from": map[string]interface{}{"id": "user1", "username": "user1"},
}
safeCall_Cov13(func() {
_, _ = parseIGCommentChangeValue(val)
})
}
func TestParseIGCommentChangeValue_Empty_Cov13(t *testing.T) {
safeCall_Cov13(func() {
_, _ = parseIGCommentChangeValue(map[string]interface{}{})
})
}
func TestParseIGCommentChangeValue_Nil_Cov13(t *testing.T) {
safeCall_Cov13(func() {
_, _ = parseIGCommentChangeValue(nil)
})
}
// =====================================================================
// webhook_handler.go — ExtractIncomingMessageFromEvent
// =====================================================================
func TestExtractIncomingMessageFromEvent_FBMessage_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventFBMessage,
PageID: "page1",
SenderID: "sender1",
Message: &FBMessageData{
Mid: "mid123",
Text: "hello",
},
Timestamp: 1000,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelFacebook)
})
}
func TestExtractIncomingMessageFromEvent_IGMessage_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventIGMessage,
PageID: "igpage1",
SenderID: "igid1",
Message: &FBMessageData{
Mid: "mid456",
Text: "ig hello",
},
Timestamp: 2000,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelInstagram)
})
}
func TestExtractIncomingMessageFromEvent_FBMessageWithAttachments_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventFBMessage,
PageID: "page1",
SenderID: "sender1",
Message: &FBMessageData{
Mid: "mid789",
Attachments: []FBAttachment{
{Type: "image", Payload: FBAttachmentPayload{URL: "http://example.com/img.jpg", Name: "img.jpg"}},
},
},
Timestamp: 3000,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelFacebook)
})
}
func TestExtractIncomingMessageFromEvent_FBPostback_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventFBPostback,
PageID: "page1",
SenderID: "sender1",
Postback: &FBPostback{
Title: "Get Started",
Data: "GET_STARTED_PAYLOAD",
},
Timestamp: 4000,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelFacebook)
})
}
func TestExtractIncomingMessageFromEvent_FBPostbackWithReferral_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventFBPostback,
PageID: "page1",
SenderID: "sender1",
Postback: &FBPostback{
Title: "Get Started",
Data: "GET_STARTED",
Referral: &FBReferral{Ref: "refcode", Source: "m.me", Type: "OPEN_THREAD"},
},
Timestamp: 5000,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelFacebook)
})
}
func TestExtractIncomingMessageFromEvent_IGPostback_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventIGPostback,
PageID: "igpage1",
SenderID: "igid1",
Postback: &FBPostback{
Title: "IG Button",
Data: "IG_PAYLOAD",
},
Timestamp: 6000,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelInstagram)
})
}
func TestExtractIncomingMessageFromEvent_EchoMessage_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventFBMessageEcho,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelFacebook)
})
}
func TestExtractIncomingMessageFromEvent_DeliveryReceipt_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventFBDelivery,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelFacebook)
})
}
func TestExtractIncomingMessageFromEvent_ReadReceipt_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventFBRead,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelFacebook)
})
}
func TestExtractIncomingMessageFromEvent_PassThread_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventFBPassThread,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelFacebook)
})
}
func TestExtractIncomingMessageFromEvent_FBMessageWithReplyTo_Cov13(t *testing.T) {
ev := &ParsedWebhookEvent{
EventType: EventFBMessage,
PageID: "page1",
SenderID: "sender1",
Message: &FBMessageData{
Mid: "mid_reply",
Text: "replying",
ReplyTo: &FBReplyTo{Mid: "original_mid"},
},
Timestamp: 7000,
}
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
safeCall_Cov13(func() {
_, _ = ExtractIncomingMessageFromEvent(ev, inbox, channel.ChannelFacebook)
})
}
// =====================================================================
// listener.go — FacebookEventListener and InstagramEventListener
// =====================================================================
func TestFacebookEventListener_Name_Nil_Cov13(t *testing.T) {
var l *FacebookEventListener
safeCall_Cov13(func() {
_ = l.Name()
})
}
func TestFacebookEventListener_OnEvent_Nil_Cov13(t *testing.T) {
var l *FacebookEventListener
safeCall_Cov13(func() {
_ = l.OnEvent(context.Background(), nil)
})
}
func TestFacebookEventListener_ExtractInbox_Nil_Cov13(t *testing.T) {
var l *FacebookEventListener
safeCall_Cov13(func() {
_, _ = l.extractInbox(nil)
})
}
func TestInstagramEventListener_Name_Nil_Cov13(t *testing.T) {
var l *InstagramEventListener
safeCall_Cov13(func() {
_ = l.Name()
})
}
func TestInstagramEventListener_OnEvent_Nil_Cov13(t *testing.T) {
var l *InstagramEventListener
safeCall_Cov13(func() {
_ = l.OnEvent(context.Background(), nil)
})
}
func TestInstagramEventListener_ExtractInbox_Nil_Cov13(t *testing.T) {
var l *InstagramEventListener
safeCall_Cov13(func() {
_, _ = l.extractInbox(nil)
})
}
func TestExtractInboxFromEvent_NoInbox_Cov13(t *testing.T) {
ev := &channel.ChannelEvent{
Type: channel.EventMessageOutgoing,
Data: map[string]interface{}{},
}
safeCall_Cov13(func() {
_, _ = extractInboxFromEvent(ev)
})
}
func TestExtractInboxFromEvent_WithInboxPointer_Cov13(t *testing.T) {
inbox := &model.Inbox{Base: model.Base{ID: 1}, AccountID: 1}
ev := &channel.ChannelEvent{
Type: channel.EventMessageOutgoing,
Data: map[string]interface{}{
"inbox": inbox,
},
}
safeCall_Cov13(func() {
_, _ = extractInboxFromEvent(ev)
})
}
func TestExtractInboxFromEvent_WithInboxValue_Cov13(t *testing.T) {
inbox := model.Inbox{Base: model.Base{ID: 2}, AccountID: 2}
ev := &channel.ChannelEvent{
Type: channel.EventMessageOutgoing,
Data: map[string]interface{}{
"inbox": inbox,
},
}
safeCall_Cov13(func() {
_, _ = extractInboxFromEvent(ev)
})
}
func TestExtractInboxFromEvent_WithWrongType_Cov13(t *testing.T) {
ev := &channel.ChannelEvent{
Type: channel.EventMessageOutgoing,
Data: map[string]interface{}{
"inbox": "not an inbox",
},
}
safeCall_Cov13(func() {
_, _ = extractInboxFromEvent(ev)
})
}
// =====================================================================
// provider.go — FacebookProvider nil-receiver tests
// =====================================================================
func TestFacebookProvider_Type_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() { _ = p.Type() })
}
func TestFacebookProvider_Name_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() { _ = p.Name() })
}
func TestFacebookProvider_Description_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() { _ = p.Description() })
}
func TestFacebookProvider_ConfigSchema_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() { _ = p.ConfigSchema() })
}
func TestFacebookProvider_DefaultConfig_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() { _ = p.DefaultConfig() })
}
func TestFacebookProvider_Capabilities_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() { _ = p.Capabilities() })
}
func TestFacebookProvider_OAuthConfig_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() { _ = p.OAuthConfig() })
}
func TestFacebookProvider_ValidateConfig_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.ValidateConfig(context.Background(), nil)
})
}
func TestFacebookProvider_OnCreate_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.OnCreate(context.Background(), nil, nil)
})
}
func TestFacebookProvider_OnDestroy_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.OnDestroy(context.Background(), nil, nil)
})
}
func TestFacebookProvider_ProcessIncoming_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.ProcessIncoming(context.Background(), nil, nil)
})
}
func TestFacebookProvider_SendMessage_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.SendMessage(context.Background(), nil, nil, nil)
})
}
func TestFacebookProvider_GetContactProfile_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.GetContactProfile(context.Background(), nil, "")
})
}
func TestFacebookProvider_ValidateWebhookRequest_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.ValidateWebhookRequest(context.Background(), nil, nil)
})
}
func TestFacebookProvider_BuildAuthURL_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.BuildAuthURL(context.Background(), 0, "")
})
}
func TestFacebookProvider_ExchangeToken_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.ExchangeToken(context.Background(), "", "")
})
}
func TestFacebookProvider_ExchangeLongLivedUserToken_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.ExchangeLongLivedUserToken(context.Background(), "")
})
}
func TestFacebookProvider_ListFacebookPages_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.ListFacebookPages(context.Background(), "")
})
}
func TestFacebookProvider_FetchInstagramBusinessAccountID_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.FetchInstagramBusinessAccountID(context.Background(), "")
})
}
func TestFacebookProvider_RefreshToken_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.RefreshToken(context.Background(), nil, nil)
})
}
func TestFacebookProvider_CheckAuthorizationError_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.CheckAuthorizationError(context.Background(), nil)
})
}
func TestFacebookProvider_OnReauthorization_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.OnReauthorization(context.Background(), nil)
})
}
func TestFacebookProvider_CreateChannel_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.CreateChannel(context.Background(), 0, nil)
})
}
func TestFacebookProvider_UpdateChannel_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.UpdateChannel(context.Background(), 0, nil)
})
}
func TestFacebookProvider_DeleteChannel_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.DeleteChannel(context.Background(), 0)
})
}
func TestFacebookProvider_HandleWebhook_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.HandleWebhook(context.Background(), nil)
})
}
func TestFacebookProvider_ProcessIncomingMessage_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.ProcessIncomingMessage(context.Background(), nil, nil)
})
}
func TestFacebookProvider_SendTypingOn_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.SendTypingOn(context.Background(), "", "")
})
}
func TestFacebookProvider_SendTypingOff_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.SendTypingOff(context.Background(), "", "")
})
}
func TestFacebookProvider_MarkSeen_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.MarkSeen(context.Background(), "", "")
})
}
func TestFacebookProvider_TakeThreadControl_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.TakeThreadControl(context.Background(), nil, "")
})
}
func TestFacebookProvider_GetPageAccessTokenFromInbox_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.GetPageAccessTokenFromInbox(nil)
})
}
func TestFacebookProvider_ExtractRecipientPSID_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.extractRecipientPSID(nil)
})
}
func TestFacebookProvider_GetPageAccessTokenFromInbox_Private_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.getPageAccessTokenFromInbox(nil)
})
}
func TestFacebookProvider_MapContentTypeToFBAttachmentType_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.mapContentTypeToFBAttachmentType("")
})
}
func TestFacebookProvider_ProcessMessagingEvent_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_, _ = p.processMessagingEvent(nil, nil)
})
}
func TestFacebookProvider_ProcessFBAttachments_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.processFBAttachments(nil)
})
}
func TestFacebookProvider_SetupWebhookSubscription_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.setupWebhookSubscription(context.Background(), "", "", "", "")
})
}
func TestFacebookProvider_UnsubscribeWebhook_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
p.unsubscribeWebhook(context.Background(), "", "", "")
})
}
func TestFacebookProvider_SendSenderAction_Nil_Cov13(t *testing.T) {
var p *FacebookProvider
safeCall_Cov13(func() {
_ = p.sendSenderAction(context.Background(), "", "", "")
})
}
// =====================================================================
// instagram_provider.go — InstagramProvider nil-receiver tests
// =====================================================================
func TestInstagramProvider_Type_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() { _ = p.Type() })
}
func TestInstagramProvider_Name_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() { _ = p.Name() })
}
func TestInstagramProvider_Description_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() { _ = p.Description() })
}
func TestInstagramProvider_ConfigSchema_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() { _ = p.ConfigSchema() })
}
func TestInstagramProvider_DefaultConfig_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() { _ = p.DefaultConfig() })
}
func TestInstagramProvider_Capabilities_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() { _ = p.Capabilities() })
}
func TestInstagramProvider_OAuthConfig_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() { _ = p.OAuthConfig() })
}
func TestInstagramProvider_ValidateConfig_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.ValidateConfig(context.Background(), nil)
})
}
func TestInstagramProvider_OnCreate_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.OnCreate(context.Background(), nil, nil)
})
}
func TestInstagramProvider_OnDestroy_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.OnDestroy(context.Background(), nil, nil)
})
}
func TestInstagramProvider_ProcessIncoming_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.ProcessIncoming(context.Background(), nil, nil)
})
}
func TestInstagramProvider_SendMessage_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.SendMessage(context.Background(), nil, nil, nil)
})
}
func TestInstagramProvider_GetContactProfile_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.GetContactProfile(context.Background(), nil, "")
})
}
func TestInstagramProvider_ValidateWebhookRequest_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.ValidateWebhookRequest(context.Background(), nil, nil)
})
}
func TestInstagramProvider_BuildAuthURL_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.BuildAuthURL(context.Background(), 0, "")
})
}
func TestInstagramProvider_ExchangeToken_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.ExchangeToken(context.Background(), "", "")
})
}
func TestInstagramProvider_RefreshToken_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.RefreshToken(context.Background(), nil, nil)
})
}
func TestInstagramProvider_CheckAuthorizationError_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.CheckAuthorizationError(context.Background(), nil)
})
}
func TestInstagramProvider_OnReauthorization_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.OnReauthorization(context.Background(), nil)
})
}
func TestInstagramProvider_CreateChannel_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.CreateChannel(context.Background(), 0, nil)
})
}
func TestInstagramProvider_UpdateChannel_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.UpdateChannel(context.Background(), 0, nil)
})
}
func TestInstagramProvider_DeleteChannel_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.DeleteChannel(context.Background(), 0)
})
}
func TestInstagramProvider_HandleWebhook_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.HandleWebhook(context.Background(), nil)
})
}
func TestInstagramProvider_ProcessIncomingMessage_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.ProcessIncomingMessage(context.Background(), nil, nil)
})
}
func TestInstagramProvider_ProcessCommentIncoming_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.ProcessCommentIncoming(context.Background(), nil, nil, "")
})
}
func TestInstagramProvider_SendTypingOn_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.SendTypingOn(context.Background(), "", "")
})
}
func TestInstagramProvider_SendTypingOff_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.SendTypingOff(context.Background(), "", "")
})
}
func TestInstagramProvider_ExtractRecipientIGID_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.extractRecipientIGID(nil)
})
}
func TestInstagramProvider_GetPageAccessTokenFromInbox_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.getPageAccessTokenFromInbox(nil)
})
}
func TestInstagramProvider_MapContentTypeToIGAttachmentType_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.mapContentTypeToIGAttachmentType("")
})
}
func TestInstagramProvider_ProcessIGMessagingEvent_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.processIGMessagingEvent(nil, nil)
})
}
func TestInstagramProvider_ProcessIGAttachments_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.processIGAttachments(nil)
})
}
func TestInstagramProvider_SendSenderAction_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.sendSenderAction(context.Background(), "", "", "")
})
}
func TestInstagramProvider_GetComments_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.GetComments(context.Background(), "", "", 0, "")
})
}
func TestInstagramProvider_GetCommentReplies_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.GetCommentReplies(context.Background(), "", "", 0, "")
})
}
func TestInstagramProvider_ReplyToComment_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.ReplyToComment(context.Background(), "", "", "")
})
}
func TestInstagramProvider_HideComment_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.HideComment(context.Background(), "", "", false)
})
}
func TestInstagramProvider_DeleteComment_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.DeleteComment(context.Background(), "", "")
})
}
func TestInstagramProvider_RegisterWebhook_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.RegisterWebhook(context.Background(), "", "")
})
}
func TestInstagramProvider_ListWebhooks_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_, _ = p.ListWebhooks(context.Background(), "", "")
})
}
func TestInstagramProvider_DeleteWebhook_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.DeleteWebhook(context.Background(), "", "")
})
}
func TestInstagramProvider_GetPageAccessTokenFromInbox_Exported_Nil_Cov13(t *testing.T) {
var p *InstagramProvider
safeCall_Cov13(func() {
_ = p.GetPageAccessTokenFromInbox(nil)
})
}