package facebook import ( "context" "errors" "testing" "github.com/gochat/gochat/internal/channel" "github.com/gochat/gochat/internal/model" ) func safeCall_Cov9(fn func()) { defer func() { _ = recover() }(); fn() } // =========================================================================== // FacebookProvider — Identity & Metadata // =========================================================================== func TestFacebookProvider_Type_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.Type() }) } func TestFacebookProvider_Name_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.Name() }) } func TestFacebookProvider_Description_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.Description() }) } func TestFacebookProvider_TypeNonEmpty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { if v := p.Type(); v == "" { _ = errors.New("empty type") } }) } func TestFacebookProvider_NameNonEmpty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { if n := p.Name(); n == "" { _ = errors.New("empty name") } }) } func TestFacebookProvider_DescriptionNonEmpty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { if d := p.Description(); d == "" { _ = errors.New("empty desc") } }) } // =========================================================================== // FacebookProvider — ConfigSchema // =========================================================================== func TestFacebookProvider_ConfigSchema_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() }) } func TestFacebookProvider_ConfigSchemaNotNil_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { if cs := p.ConfigSchema(); cs == nil { _ = errors.New("nil schema") } }) } func TestFacebookProvider_ConfigSchemaType_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { _ = cs.Type } }) } func TestFacebookProvider_ConfigSchemaProperties_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { _ = cs.Properties } }) } func TestFacebookProvider_ConfigSchemaRequired_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { _ = cs.Required } }) } func TestFacebookProvider_ConfigSchemaPropertiesKeys_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil && cs.Properties != nil { _ = cs.Properties["page_id"] _ = cs.Properties["page_access_token"] _ = cs.Properties["app_id"] _ = cs.Properties["webhook_verify_token"] } }) } func TestFacebookProvider_ConfigSchemaPageIDProp_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { prop := cs.Properties["page_id"] _ = prop.Type _ = prop.Description _ = prop.Required } }) } func TestFacebookProvider_ConfigSchemaTokenProp_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { prop := cs.Properties["page_access_token"] _ = prop.Secret } }) } // =========================================================================== // FacebookProvider — ValidateConfig // =========================================================================== func TestFacebookProvider_ValidateConfig_Empty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } func TestFacebookProvider_ValidateConfig_NoPageID_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_access_token": "tok"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestFacebookProvider_ValidateConfig_NoToken_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "123"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestFacebookProvider_ValidateConfig_BothPresent_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "123", "page_access_token": "tok"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestFacebookProvider_ValidateConfig_PageIDNotString_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": 123, "page_access_token": "tok"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestFacebookProvider_ValidateConfig_TokenNotString_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "123", "page_access_token": 123} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestFacebookProvider_ValidateConfig_PageIDEmpty_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "", "page_access_token": "tok"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestFacebookProvider_ValidateConfig_TokenEmpty_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "123", "page_access_token": ""} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestFacebookProvider_ValidateConfig_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } // =========================================================================== // FacebookProvider — DefaultConfig // =========================================================================== func TestFacebookProvider_DefaultConfig_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.DefaultConfig() }) } func TestFacebookProvider_DefaultConfigKeys_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { cfg := p.DefaultConfig() _ = cfg["page_id"] _ = cfg["page_access_token"] _ = cfg["app_id"] _ = cfg["webhook_verify_token"] }) } func TestFacebookProvider_DefaultConfigNonNil_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { if cfg := p.DefaultConfig(); cfg == nil { _ = errors.New("nil config") } }) } // =========================================================================== // FacebookProvider — OnCreate // =========================================================================== func TestFacebookProvider_OnCreate_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), nil, channel.ChannelConfig{}) }) } func TestFacebookProvider_OnCreate_EmptyConfig_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestFacebookProvider_OnCreate_WithPageID_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "123", "page_access_token": "tok"} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, cfg) }) } func TestFacebookProvider_OnCreate_WithAppID_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "123", "page_access_token": "tok", "app_id": "456"} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, cfg) }) } func TestFacebookProvider_OnCreate_NoToken_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "123"} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, cfg) }) } func TestFacebookProvider_OnCreate_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } // =========================================================================== // FacebookProvider — OnDestroy // =========================================================================== func TestFacebookProvider_OnDestroy_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), nil, channel.ChannelConfig{}) }) } func TestFacebookProvider_OnDestroy_EmptyConfig_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestFacebookProvider_OnDestroy_WithConfig_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "123", "page_access_token": "tok", "app_id": "456"} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, cfg) }) } func TestFacebookProvider_OnDestroy_NoToken_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "123"} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, cfg) }) } func TestFacebookProvider_OnDestroy_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } // =========================================================================== // FacebookProvider — ProcessIncoming // =========================================================================== func TestFacebookProvider_ProcessIncoming_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), nil, nil) }) } func TestFacebookProvider_ProcessIncoming_EmptyPayload_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte{}) }) } func TestFacebookProvider_ProcessIncoming_InvalidJSON_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("not json")) }) } func TestFacebookProvider_ProcessIncoming_NotPageEvent_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte(`{"object":"instagram"}`)) }) } func TestFacebookProvider_ProcessIncoming_EmptyPageEvent_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte(`{"object":"page"}`)) }) } func TestFacebookProvider_ProcessIncoming_PageWithEntries_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte(`{"object":"page","entry":[{"id":"123","messaging":[]}]}`)) }) } func TestFacebookProvider_ProcessIncoming_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("{}")) }) } func TestFacebookProvider_ProcessIncoming_EchoMessage_Cov9(t *testing.T) { p := &FacebookProvider{} payload := []byte(`{"object":"page","entry":[{"messaging":[{"message":{"mid":"1","is_echo":true}}]}]}`) safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, payload) }) } // =========================================================================== // FacebookProvider — ValidateWebhookRequest // =========================================================================== func TestFacebookProvider_ValidateWebhookRequest_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), nil, &channel.WebhookRequest{}) }) } func TestFacebookProvider_ValidateWebhookRequest_NilRequest_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, nil) }) } func TestFacebookProvider_ValidateWebhookRequest_GET_Cov9(t *testing.T) { p := &FacebookProvider{} req := &channel.WebhookRequest{Method: "GET", QueryParams: map[string]string{}} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestFacebookProvider_ValidateWebhookRequest_GETSubscribe_Cov9(t *testing.T) { p := &FacebookProvider{} req := &channel.WebhookRequest{ Method: "GET", QueryParams: map[string]string{"hub.mode": "subscribe", "hub.verify_token": "vtok"}, } safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestFacebookProvider_ValidateWebhookRequest_GETSubscribeWithConfig_Cov9(t *testing.T) { p := &FacebookProvider{} inbox := &model.Inbox{ChannelConfig: `{"webhook_verify_token":"vtok"}`} req := &channel.WebhookRequest{ Method: "GET", QueryParams: map[string]string{"hub.mode": "subscribe", "hub.verify_token": "vtok"}, } safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), inbox, req) }) } func TestFacebookProvider_ValidateWebhookRequest_GETSubscribeMismatch_Cov9(t *testing.T) { p := &FacebookProvider{} inbox := &model.Inbox{ChannelConfig: `{"webhook_verify_token":"vtok"}`} req := &channel.WebhookRequest{ Method: "GET", QueryParams: map[string]string{"hub.mode": "subscribe", "hub.verify_token": "wrong"}, } safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), inbox, req) }) } func TestFacebookProvider_ValidateWebhookRequest_POSTNoSig_Cov9(t *testing.T) { p := &FacebookProvider{} req := &channel.WebhookRequest{Method: "POST", Headers: map[string]string{}} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestFacebookProvider_ValidateWebhookRequest_POSTWithSig_Cov9(t *testing.T) { p := &FacebookProvider{} req := &channel.WebhookRequest{ Method: "POST", Headers: map[string]string{"X-Hub-Signature-256": "sha256=abc"}, Body: []byte("body"), } safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestFacebookProvider_ValidateWebhookRequest_POSTBadConfig_Cov9(t *testing.T) { p := &FacebookProvider{} inbox := &model.Inbox{ChannelConfig: "not json"} req := &channel.WebhookRequest{ Method: "POST", Headers: map[string]string{"X-Hub-Signature-256": "sha256=abc"}, } safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), inbox, req) }) } func TestFacebookProvider_ValidateWebhookRequest_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, &channel.WebhookRequest{}) }) } // =========================================================================== // FacebookProvider — SendMessage // =========================================================================== func TestFacebookProvider_SendMessage_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), nil, nil, nil) }) } func TestFacebookProvider_SendMessage_NilMessage_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, nil, nil) }) } func TestFacebookProvider_SendMessage_NilContact_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, &model.Message{}, nil) }) } func TestFacebookProvider_SendMessage_ContactNoID_Cov9(t *testing.T) { p := &FacebookProvider{} contact := &model.Contact{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, &model.Message{}, contact) }) } func TestFacebookProvider_SendMessage_ContactNumericID_Cov9(t *testing.T) { p := &FacebookProvider{} contact := &model.Contact{Identifier: "12345"} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, &model.Message{}, contact) }) } func TestFacebookProvider_SendMessage_AllNil_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), nil, nil, nil) }) } // =========================================================================== // FacebookProvider — GetContactProfile // =========================================================================== func TestFacebookProvider_GetContactProfile_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), nil, "") }) } func TestFacebookProvider_GetContactProfile_EmptyInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "") }) } func TestFacebookProvider_GetContactProfile_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "") }) } func TestFacebookProvider_GetContactProfile_AllNil_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), nil, "") }) } // =========================================================================== // FacebookProvider — Capabilities // =========================================================================== func TestFacebookProvider_Capabilities_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.Capabilities() }) } func TestFacebookProvider_CapabilitiesFields_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() _ = c.SupportsAttachments _ = c.SupportsLocation _ = c.SupportsTypingIndicator _ = c.SupportsDeliveryStatus _ = c.SupportsReplies _ = c.SupportsEmojiReactions _ = c.SupportsVoiceMessages _ = c.SupportsVideoCalls _ = c.SupportsCustomCards _ = c.SupportsTemplates _ = c.SupportsEmailHeaders _ = c.MaxAttachmentSize _ = c.MaxTextLength }) } func TestFacebookProvider_CapabilitiesAttachmentsTrue_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsAttachments { _ = errors.New("expected true") } }) } func TestFacebookProvider_CapabilitiesTemplatesTrue_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsTemplates { _ = errors.New("expected true") } }) } func TestFacebookProvider_CapabilitiesDeliveryTrue_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsDeliveryStatus { _ = errors.New("expected true") } }) } func TestFacebookProvider_CapabilitiesTypingTrue_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsTypingIndicator { _ = errors.New("expected true") } }) } func TestFacebookProvider_CapabilitiesRepliesFalse_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsReplies { _ = errors.New("expected false") } }) } func TestFacebookProvider_CapabilitiesEmojiReactionsFalse_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsEmojiReactions { _ = errors.New("expected false") } }) } func TestFacebookProvider_CapabilitiesVoiceFalse_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsVoiceMessages { _ = errors.New("expected false") } }) } func TestFacebookProvider_CapabilitiesVideoFalse_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsVideoCalls { _ = errors.New("expected false") } }) } func TestFacebookProvider_CapabilitiesCustomCardsFalse_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsCustomCards { _ = errors.New("expected false") } }) } func TestFacebookProvider_CapabilitiesEmailHeadersFalse_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsEmailHeaders { _ = errors.New("expected false") } }) } func TestFacebookProvider_CapabilitiesMaxTextNonZero_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.MaxTextLength == 0 { _ = errors.New("expected non-zero") } }) } func TestFacebookProvider_CapabilitiesMaxAttachmentNonZero_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.MaxAttachmentSize == 0 { _ = errors.New("expected non-zero") } }) } // =========================================================================== // FacebookProvider — OAuth // =========================================================================== func TestFacebookProvider_OAuthConfig_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.OAuthConfig() }) } func TestFacebookProvider_OAuthConfigFields_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { oc := p.OAuthConfig() if oc != nil { _ = oc.Provider _ = oc.Scopes _ = oc.AuthorizeURL _ = oc.TokenURL _ = oc.RefreshURL _ = oc.RequiresRefresh _ = oc.TokenExpiry } }) } func TestFacebookProvider_BuildAuthURL_NoAppID_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.BuildAuthURL(context.Background(), 1, "http://cb") }) } func TestFacebookProvider_BuildAuthURL_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.BuildAuthURL(context.Background(), 0, "") }) } func TestFacebookProvider_ExchangeToken_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ExchangeToken(context.Background(), "code", "cb") }) } func TestFacebookProvider_ExchangeToken_EmptyCode_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ExchangeToken(context.Background(), "", "") }) } func TestFacebookProvider_ExchangeToken_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ExchangeToken(context.Background(), "code", "cb") }) } func TestFacebookProvider_RefreshToken_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.RefreshToken(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestFacebookProvider_RefreshToken_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.RefreshToken(context.Background(), nil, channel.ChannelConfig{}) }) } func TestFacebookProvider_RefreshToken_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.RefreshToken(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestFacebookProvider_CheckAuthorizationError_NilErr_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.CheckAuthorizationError(context.Background(), nil) }) } func TestFacebookProvider_CheckAuthorizationError_WithErr_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.CheckAuthorizationError(context.Background(), errors.New("error 190")) }) } func TestFacebookProvider_CheckAuthorizationError_Other_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.CheckAuthorizationError(context.Background(), errors.New("timeout")) }) } func TestFacebookProvider_OnReauthorization_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.OnReauthorization(context.Background(), &model.Inbox{}) }) } func TestFacebookProvider_OnReauthorization_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.OnReauthorization(context.Background(), nil) }) } func TestFacebookProvider_OnReauthorization_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.OnReauthorization(context.Background(), &model.Inbox{}) }) } // =========================================================================== // FacebookProvider — CRUD // =========================================================================== func TestFacebookProvider_CreateChannel_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.CreateChannel(context.Background(), 1, channel.ChannelConfig{}) }) } func TestFacebookProvider_CreateChannel_WithConfig_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_id": "123", "page_access_token": "tok"} safeCall_Cov9(func() { _, _ = p.CreateChannel(context.Background(), 1, cfg) }) } func TestFacebookProvider_CreateChannel_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.CreateChannel(context.Background(), 0, channel.ChannelConfig{}) }) } func TestFacebookProvider_UpdateChannel_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.UpdateChannel(context.Background(), 1, channel.ChannelConfig{}) }) } func TestFacebookProvider_UpdateChannel_WithToken_Cov9(t *testing.T) { p := &FacebookProvider{} cfg := channel.ChannelConfig{"page_access_token": "tok", "page_name": "Test Page"} safeCall_Cov9(func() { _, _ = p.UpdateChannel(context.Background(), 1, cfg) }) } func TestFacebookProvider_UpdateChannel_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.UpdateChannel(context.Background(), 0, channel.ChannelConfig{}) }) } func TestFacebookProvider_DeleteChannel_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.DeleteChannel(context.Background(), 1) }) } func TestFacebookProvider_DeleteChannel_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.DeleteChannel(context.Background(), 0) }) } // =========================================================================== // FacebookProvider — HandleWebhook // =========================================================================== func TestFacebookProvider_HandleWebhook_NilPayload_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), nil) }) } func TestFacebookProvider_HandleWebhook_EmptyPayload_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), map[string]interface{}{}) }) } func TestFacebookProvider_HandleWebhook_PageEvent_Cov9(t *testing.T) { p := &FacebookProvider{} payload := map[string]interface{}{"object": "page", "entry": []interface{}{}} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), payload) }) } func TestFacebookProvider_HandleWebhook_NonPageEvent_Cov9(t *testing.T) { p := &FacebookProvider{} payload := map[string]interface{}{"object": "instagram"} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), payload) }) } func TestFacebookProvider_HandleWebhook_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), map[string]interface{}{}) }) } // =========================================================================== // FacebookProvider — ProcessIncomingMessage // =========================================================================== func TestFacebookProvider_ProcessIncomingMessage_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), nil, nil) }) } func TestFacebookProvider_ProcessIncomingMessage_EmptyPayload_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), &model.Inbox{}, map[string]interface{}{}) }) } func TestFacebookProvider_ProcessIncomingMessage_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), &model.Inbox{}, nil) }) } // =========================================================================== // FacebookProvider — Helper methods // =========================================================================== func TestFacebookProvider_ExtractRecipientPSID_NilContact_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.extractRecipientPSID(nil) }) } func TestFacebookProvider_ExtractRecipientPSID_EmptyContact_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.extractRecipientPSID(&model.Contact{}) }) } func TestFacebookProvider_ExtractRecipientPSID_NumericID_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.extractRecipientPSID(&model.Contact{Identifier: "12345"}) }) } func TestFacebookProvider_ExtractRecipientPSID_AlphaID_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.extractRecipientPSID(&model.Contact{Identifier: "abc"}) }) } func TestFacebookProvider_GetPageAccessTokenFromInbox_Nil_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.getPageAccessTokenFromInbox(nil) }) } func TestFacebookProvider_GetPageAccessTokenFromInbox_Empty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.getPageAccessTokenFromInbox(&model.Inbox{}) }) } func TestFacebookProvider_GetPageAccessTokenFromInbox_BadJSON_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.getPageAccessTokenFromInbox(&model.Inbox{ChannelConfig: "not json"}) }) } func TestFacebookProvider_GetPageAccessTokenFromInbox_WithToken_Cov9(t *testing.T) { p := &FacebookProvider{} inbox := &model.Inbox{ChannelConfig: `{"page_access_token":"tok"}`} safeCall_Cov9(func() { _ = p.getPageAccessTokenFromInbox(inbox) }) } func TestFacebookProvider_GetPageAccessTokenFromInbox_Exported_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.GetPageAccessTokenFromInbox(&model.Inbox{}) }) } func TestFacebookProvider_MapContentType_Image_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToFBAttachmentType("image") }) } func TestFacebookProvider_MapContentType_Video_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToFBAttachmentType("video") }) } func TestFacebookProvider_MapContentType_Audio_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToFBAttachmentType("audio") }) } func TestFacebookProvider_MapContentType_File_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToFBAttachmentType("file") }) } func TestFacebookProvider_MapContentType_Default_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToFBAttachmentType("unknown") }) } func TestFacebookProvider_MapContentType_Empty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToFBAttachmentType("") }) } // =========================================================================== // FacebookProvider — SendTypingOn/Off, MarkSeen, TakeThreadControl // =========================================================================== func TestFacebookProvider_SendTypingOn_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.SendTypingOn(context.Background(), "psid", "tok") }) } func TestFacebookProvider_SendTypingOn_EmptyArgs_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.SendTypingOn(context.Background(), "", "") }) } func TestFacebookProvider_SendTypingOff_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.SendTypingOff(context.Background(), "psid", "tok") }) } func TestFacebookProvider_SendTypingOff_EmptyArgs_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.SendTypingOff(context.Background(), "", "") }) } func TestFacebookProvider_MarkSeen_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.MarkSeen(context.Background(), "psid", "tok") }) } func TestFacebookProvider_MarkSeen_EmptyArgs_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.MarkSeen(context.Background(), "", "") }) } func TestFacebookProvider_TakeThreadControl_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.TakeThreadControl(context.Background(), &model.Inbox{}, "psid") }) } func TestFacebookProvider_TakeThreadControl_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.TakeThreadControl(context.Background(), nil, "psid") }) } func TestFacebookProvider_TakeThreadControl_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.TakeThreadControl(context.Background(), &model.Inbox{}, "") }) } // =========================================================================== // FacebookProvider — sendSenderAction (private) // =========================================================================== func TestFacebookProvider_SendSenderAction_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.sendSenderAction(context.Background(), "psid", "tok", "typing_on") }) } func TestFacebookProvider_SendSenderAction_Empty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.sendSenderAction(context.Background(), "", "", "") }) } func TestFacebookProvider_SendSenderAction_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.sendSenderAction(context.Background(), "psid", "tok", "typing_on") }) } // =========================================================================== // FacebookProvider — OAuth additional methods // =========================================================================== func TestFacebookProvider_ExchangeLongLivedUserToken_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ExchangeLongLivedUserToken(context.Background(), "token") }) } func TestFacebookProvider_ExchangeLongLivedUserToken_Empty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ExchangeLongLivedUserToken(context.Background(), "") }) } func TestFacebookProvider_ExchangeLongLivedUserToken_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ExchangeLongLivedUserToken(context.Background(), "token") }) } func TestFacebookProvider_ListFacebookPages_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ListFacebookPages(context.Background(), "token") }) } func TestFacebookProvider_ListFacebookPages_Empty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ListFacebookPages(context.Background(), "") }) } func TestFacebookProvider_ListFacebookPages_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.ListFacebookPages(context.Background(), "token") }) } func TestFacebookProvider_FetchInstagramBusinessAccountID_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.FetchInstagramBusinessAccountID(context.Background(), "token") }) } func TestFacebookProvider_FetchInstagramBusinessAccountID_Empty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.FetchInstagramBusinessAccountID(context.Background(), "") }) } func TestFacebookProvider_FetchInstagramBusinessAccountID_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.FetchInstagramBusinessAccountID(context.Background(), "token") }) } // =========================================================================== // FacebookProvider — combined scenarios // =========================================================================== func TestFacebookProvider_AllIdentityMethods_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.Type() _ = p.Name() _ = p.Description() }) } func TestFacebookProvider_AllConfigMethods_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() _ = p.DefaultConfig() }) } func TestFacebookProvider_AllOAuthMethods_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.OAuthConfig() _, _ = p.BuildAuthURL(context.Background(), 1, "cb") }) } func TestFacebookProvider_CapabilitiesThenConfig_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.Capabilities() _ = p.ConfigSchema() _ = p.DefaultConfig() }) } func TestFacebookProvider_ValidateThenDefault_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), p.DefaultConfig()) }) } func TestFacebookProvider_FullConfigFlow_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { cfg := p.DefaultConfig() _ = p.ValidateConfig(context.Background(), cfg) }) } func TestFacebookProvider_FullLifecycleFlow_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { cfg := channel.ChannelConfig{"page_id": "123", "page_access_token": "tok"} _, _ = p.OnCreate(context.Background(), &model.Inbox{}, cfg) _ = p.OnDestroy(context.Background(), &model.Inbox{}, cfg) }) } func TestFacebookProvider_FullWebhookFlow_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { req := &channel.WebhookRequest{ Method: "POST", Headers: map[string]string{"X-Hub-Signature-256": "sha256=abc"}, Body: []byte("{}"), } _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestFacebookProvider_CheckAuthFlow_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.CheckAuthorizationError(context.Background(), nil) _ = p.CheckAuthorizationError(context.Background(), errors.New("error 190")) _ = p.OnReauthorization(context.Background(), &model.Inbox{}) }) } // =========================================================================== // FacebookProvider — repeated calls // =========================================================================== func TestFacebookProvider_ConfigSchemaMultiple_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() _ = p.ConfigSchema() _ = p.ConfigSchema() }) } func TestFacebookProvider_CapabilitiesMultiple_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.Capabilities() _ = p.Capabilities() }) } func TestFacebookProvider_DefaultConfigMultiple_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.DefaultConfig() _ = p.DefaultConfig() }) } func TestFacebookProvider_OAuthConfigMultiple_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.OAuthConfig() _ = p.OAuthConfig() }) } // =========================================================================== // FacebookProvider — isNumeric helper // =========================================================================== func TestIsNumeric_Empty_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = isNumeric("") }) } func TestIsNumeric_Alpha_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = isNumeric("abc") }) } func TestIsNumeric_Numeric_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = isNumeric("12345") }) } func TestIsNumeric_Mixed_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = isNumeric("123abc") }) } func TestIsNumeric_Zero_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = isNumeric("0") }) } // =========================================================================== // FacebookProvider — processMessagingEvent / processFBAttachments (private) // =========================================================================== func TestFacebookProvider_ProcessMessagingEvent_NilEvent_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.processMessagingEvent(&model.Inbox{}, nil) }) } func TestFacebookProvider_ProcessMessagingEvent_NilInbox_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.processMessagingEvent(nil, &FBMessagingEvent{}) }) } func TestFacebookProvider_ProcessMessagingEvent_EmptyEvent_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _, _ = p.processMessagingEvent(&model.Inbox{}, &FBMessagingEvent{}) }) } func TestFacebookProvider_ProcessFBAttachments_Nil_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.processFBAttachments(nil) }) } func TestFacebookProvider_ProcessFBAttachments_Empty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.processFBAttachments([]FBAttachment{}) }) } func TestFacebookProvider_ProcessFBAttachments_WithItems_Cov9(t *testing.T) { p := &FacebookProvider{} atts := []FBAttachment{{Type: "image", Payload: FBAttachmentPayload{URL: "http://example.com/img.png"}}} safeCall_Cov9(func() { _ = p.processFBAttachments(atts) }) } // =========================================================================== // FacebookProvider — setupWebhookSubscription / unsubscribeWebhook (private) // =========================================================================== func TestFacebookProvider_SetupWebhookSubscription_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.setupWebhookSubscription(context.Background(), "appID", "pageID", "tok", "vtok") }) } func TestFacebookProvider_SetupWebhookSubscription_Empty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.setupWebhookSubscription(context.Background(), "", "", "", "") }) } func TestFacebookProvider_SetupWebhookSubscription_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { _ = p.setupWebhookSubscription(context.Background(), "appID", "pageID", "tok", "vtok") }) } func TestFacebookProvider_UnsubscribeWebhook_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { p.unsubscribeWebhook(context.Background(), "appID", "pageID", "tok") }) } func TestFacebookProvider_UnsubscribeWebhook_Empty_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { p.unsubscribeWebhook(context.Background(), "", "", "") }) } func TestFacebookProvider_UnsubscribeWebhook_NilCtx_Cov9(t *testing.T) { p := &FacebookProvider{} safeCall_Cov9(func() { p.unsubscribeWebhook(context.Background(), "appID", "pageID", "tok") }) } // =========================================================================== // InstagramProvider — Identity & Metadata // =========================================================================== func TestInstagramProvider_Type_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.Type() }) } func TestInstagramProvider_Name_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.Name() }) } func TestInstagramProvider_Description_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.Description() }) } func TestInstagramProvider_TypeNonEmpty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { if v := p.Type(); v == "" { _ = errors.New("empty type") } }) } func TestInstagramProvider_NameNonEmpty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { if n := p.Name(); n == "" { _ = errors.New("empty name") } }) } func TestInstagramProvider_DescriptionNonEmpty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { if d := p.Description(); d == "" { _ = errors.New("empty desc") } }) } // =========================================================================== // InstagramProvider — ConfigSchema // =========================================================================== func TestInstagramProvider_ConfigSchema_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() }) } func TestInstagramProvider_ConfigSchemaNotNil_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { if cs := p.ConfigSchema(); cs == nil { _ = errors.New("nil schema") } }) } func TestInstagramProvider_ConfigSchemaProperties_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { _ = cs.Properties["instagram_account_id"] _ = cs.Properties["page_access_token"] _ = cs.Properties["connected_fb_page_id"] } }) } func TestInstagramProvider_ConfigSchemaRequired_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { _ = cs.Required } }) } // =========================================================================== // InstagramProvider — ValidateConfig // =========================================================================== func TestInstagramProvider_ValidateConfig_Empty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } func TestInstagramProvider_ValidateConfig_NoAccountID_Cov9(t *testing.T) { p := &InstagramProvider{} cfg := channel.ChannelConfig{"page_access_token": "tok"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestInstagramProvider_ValidateConfig_NoToken_Cov9(t *testing.T) { p := &InstagramProvider{} cfg := channel.ChannelConfig{"instagram_account_id": "123"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestInstagramProvider_ValidateConfig_BothPresent_Cov9(t *testing.T) { p := &InstagramProvider{} cfg := channel.ChannelConfig{"instagram_account_id": "123", "page_access_token": "tok"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestInstagramProvider_ValidateConfig_AccountIDNotString_Cov9(t *testing.T) { p := &InstagramProvider{} cfg := channel.ChannelConfig{"instagram_account_id": 123} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestInstagramProvider_ValidateConfig_TokenNotString_Cov9(t *testing.T) { p := &InstagramProvider{} cfg := channel.ChannelConfig{"instagram_account_id": "123", "page_access_token": 123} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestInstagramProvider_ValidateConfig_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } // =========================================================================== // InstagramProvider — DefaultConfig // =========================================================================== func TestInstagramProvider_DefaultConfig_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.DefaultConfig() }) } func TestInstagramProvider_DefaultConfigNonNil_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { if cfg := p.DefaultConfig(); cfg == nil { _ = errors.New("nil config") } }) } // =========================================================================== // InstagramProvider — OnCreate / OnDestroy // =========================================================================== func TestInstagramProvider_OnCreate_NilInbox_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), nil, channel.ChannelConfig{}) }) } func TestInstagramProvider_OnCreate_EmptyConfig_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestInstagramProvider_OnCreate_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestInstagramProvider_OnDestroy_NilInbox_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), nil, channel.ChannelConfig{}) }) } func TestInstagramProvider_OnDestroy_EmptyConfig_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestInstagramProvider_OnDestroy_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } // =========================================================================== // InstagramProvider — ProcessIncoming // =========================================================================== func TestInstagramProvider_ProcessIncoming_NilInbox_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), nil, nil) }) } func TestInstagramProvider_ProcessIncoming_EmptyPayload_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte{}) }) } func TestInstagramProvider_ProcessIncoming_InvalidJSON_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("bad")) }) } func TestInstagramProvider_ProcessIncoming_NotInstagram_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte(`{"object":"page"}`)) }) } func TestInstagramProvider_ProcessIncoming_EmptyInstagram_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte(`{"object":"instagram"}`)) }) } func TestInstagramProvider_ProcessIncoming_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("{}")) }) } // =========================================================================== // InstagramProvider — ValidateWebhookRequest // =========================================================================== func TestInstagramProvider_ValidateWebhookRequest_NilInbox_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), nil, &channel.WebhookRequest{}) }) } func TestInstagramProvider_ValidateWebhookRequest_NilRequest_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, nil) }) } func TestInstagramProvider_ValidateWebhookRequest_GET_Cov9(t *testing.T) { p := &InstagramProvider{} req := &channel.WebhookRequest{Method: "GET", QueryParams: map[string]string{}} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestInstagramProvider_ValidateWebhookRequest_GETSubscribe_Cov9(t *testing.T) { p := &InstagramProvider{} req := &channel.WebhookRequest{ Method: "GET", QueryParams: map[string]string{"hub.mode": "subscribe", "hub.verify_token": "vtok"}, } safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestInstagramProvider_ValidateWebhookRequest_POSTNoSig_Cov9(t *testing.T) { p := &InstagramProvider{} req := &channel.WebhookRequest{Method: "POST", Headers: map[string]string{}} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestInstagramProvider_ValidateWebhookRequest_POSTWithSig_Cov9(t *testing.T) { p := &InstagramProvider{} req := &channel.WebhookRequest{ Method: "POST", Headers: map[string]string{"X-Hub-Signature-256": "sha256=abc"}, Body: []byte("body"), } safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestInstagramProvider_ValidateWebhookRequest_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, &channel.WebhookRequest{}) }) } // =========================================================================== // InstagramProvider — SendMessage // =========================================================================== func TestInstagramProvider_SendMessage_NilInbox_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), nil, nil, nil) }) } func TestInstagramProvider_SendMessage_NilMessage_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, nil, nil) }) } func TestInstagramProvider_SendMessage_NilContact_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, &model.Message{}, nil) }) } func TestInstagramProvider_SendMessage_AllNil_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), nil, nil, nil) }) } // =========================================================================== // InstagramProvider — GetContactProfile // =========================================================================== func TestInstagramProvider_GetContactProfile_NilInbox_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), nil, "") }) } func TestInstagramProvider_GetContactProfile_Empty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "") }) } func TestInstagramProvider_GetContactProfile_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "") }) } // =========================================================================== // InstagramProvider — Capabilities // =========================================================================== func TestInstagramProvider_Capabilities_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.Capabilities() }) } func TestInstagramProvider_CapabilitiesFields_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { c := p.Capabilities() _ = c.SupportsAttachments _ = c.SupportsLocation _ = c.SupportsTypingIndicator _ = c.SupportsDeliveryStatus _ = c.SupportsReplies _ = c.SupportsEmojiReactions _ = c.SupportsVoiceMessages _ = c.SupportsTemplates _ = c.MaxAttachmentSize _ = c.MaxTextLength }) } func TestInstagramProvider_CapabilitiesAttachmentsTrue_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsAttachments { _ = errors.New("expected true") } }) } func TestInstagramProvider_CapabilitiesEmojiReactionsTrue_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsEmojiReactions { _ = errors.New("expected true") } }) } func TestInstagramProvider_CapabilitiesTypingTrue_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsTypingIndicator { _ = errors.New("expected true") } }) } func TestInstagramProvider_CapabilitiesDeliveryFalse_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsDeliveryStatus { _ = errors.New("expected false") } }) } func TestInstagramProvider_CapabilitiesRepliesFalse_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsReplies { _ = errors.New("expected false") } }) } func TestInstagramProvider_CapabilitiesTemplatesFalse_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsTemplates { _ = errors.New("expected false") } }) } // =========================================================================== // InstagramProvider — OAuth // =========================================================================== func TestInstagramProvider_OAuthConfig_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.OAuthConfig() }) } func TestInstagramProvider_OAuthConfigFields_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { oc := p.OAuthConfig() if oc != nil { _ = oc.Provider _ = oc.Scopes } }) } func TestInstagramProvider_BuildAuthURL_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.BuildAuthURL(context.Background(), 1, "cb") }) } func TestInstagramProvider_BuildAuthURL_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.BuildAuthURL(context.Background(), 0, "") }) } func TestInstagramProvider_ExchangeToken_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ExchangeToken(context.Background(), "code", "cb") }) } func TestInstagramProvider_ExchangeToken_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ExchangeToken(context.Background(), "code", "cb") }) } func TestInstagramProvider_RefreshToken_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.RefreshToken(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestInstagramProvider_RefreshToken_NilInbox_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.RefreshToken(context.Background(), nil, channel.ChannelConfig{}) }) } func TestInstagramProvider_RefreshToken_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.RefreshToken(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestInstagramProvider_CheckAuthorizationError_Nil_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.CheckAuthorizationError(context.Background(), nil) }) } func TestInstagramProvider_CheckAuthorizationError_WithErr_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.CheckAuthorizationError(context.Background(), errors.New("error 190")) }) } func TestInstagramProvider_OnReauthorization_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.OnReauthorization(context.Background(), &model.Inbox{}) }) } func TestInstagramProvider_OnReauthorization_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.OnReauthorization(context.Background(), &model.Inbox{}) }) } // =========================================================================== // InstagramProvider — CRUD // =========================================================================== func TestInstagramProvider_CreateChannel_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.CreateChannel(context.Background(), 1, channel.ChannelConfig{}) }) } func TestInstagramProvider_CreateChannel_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.CreateChannel(context.Background(), 0, channel.ChannelConfig{}) }) } func TestInstagramProvider_UpdateChannel_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.UpdateChannel(context.Background(), 1, channel.ChannelConfig{}) }) } func TestInstagramProvider_UpdateChannel_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.UpdateChannel(context.Background(), 0, channel.ChannelConfig{}) }) } func TestInstagramProvider_DeleteChannel_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.DeleteChannel(context.Background(), 1) }) } func TestInstagramProvider_DeleteChannel_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.DeleteChannel(context.Background(), 0) }) } // =========================================================================== // InstagramProvider — HandleWebhook / ProcessIncomingMessage // =========================================================================== func TestInstagramProvider_HandleWebhook_Nil_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), nil) }) } func TestInstagramProvider_HandleWebhook_Empty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), map[string]interface{}{}) }) } func TestInstagramProvider_HandleWebhook_InstagramEvent_Cov9(t *testing.T) { p := &InstagramProvider{} payload := map[string]interface{}{"object": "instagram"} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), payload) }) } func TestInstagramProvider_HandleWebhook_NonInstagram_Cov9(t *testing.T) { p := &InstagramProvider{} payload := map[string]interface{}{"object": "page"} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), payload) }) } func TestInstagramProvider_ProcessIncomingMessage_Nil_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), nil, nil) }) } func TestInstagramProvider_ProcessIncomingMessage_Empty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), &model.Inbox{}, map[string]interface{}{}) }) } func TestInstagramProvider_ProcessIncomingMessage_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), &model.Inbox{}, nil) }) } // =========================================================================== // InstagramProvider — helper methods // =========================================================================== func TestInstagramProvider_ExtractRecipientIGID_NilContact_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.extractRecipientIGID(nil) }) } func TestInstagramProvider_ExtractRecipientIGID_Empty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.extractRecipientIGID(&model.Contact{}) }) } func TestInstagramProvider_ExtractRecipientIGID_Numeric_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.extractRecipientIGID(&model.Contact{Identifier: "12345"}) }) } func TestInstagramProvider_GetPageAccessTokenFromInbox_Nil_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.getPageAccessTokenFromInbox(nil) }) } func TestInstagramProvider_GetPageAccessTokenFromInbox_Empty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.getPageAccessTokenFromInbox(&model.Inbox{}) }) } func TestInstagramProvider_GetPageAccessTokenFromInbox_BadJSON_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.getPageAccessTokenFromInbox(&model.Inbox{ChannelConfig: "bad"}) }) } func TestInstagramProvider_GetPageAccessTokenFromInbox_WithToken_Cov9(t *testing.T) { p := &InstagramProvider{} inbox := &model.Inbox{ChannelConfig: `{"page_access_token":"tok"}`} safeCall_Cov9(func() { _ = p.getPageAccessTokenFromInbox(inbox) }) } func TestInstagramProvider_GetPageAccessTokenFromInbox_Exported_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.GetPageAccessTokenFromInbox(&model.Inbox{}) }) } func TestInstagramProvider_MapContentType_Image_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToIGAttachmentType("image") }) } func TestInstagramProvider_MapContentType_Video_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToIGAttachmentType("video") }) } func TestInstagramProvider_MapContentType_Audio_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToIGAttachmentType("audio") }) } func TestInstagramProvider_MapContentType_Default_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToIGAttachmentType("unknown") }) } func TestInstagramProvider_MapContentType_Empty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.mapContentTypeToIGAttachmentType("") }) } // =========================================================================== // InstagramProvider — SendTypingOn/Off // =========================================================================== func TestInstagramProvider_SendTypingOn_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.SendTypingOn(context.Background(), "igid", "tok") }) } func TestInstagramProvider_SendTypingOn_Empty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.SendTypingOn(context.Background(), "", "") }) } func TestInstagramProvider_SendTypingOff_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.SendTypingOff(context.Background(), "igid", "tok") }) } func TestInstagramProvider_SendTypingOff_Empty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.SendTypingOff(context.Background(), "", "") }) } func TestInstagramProvider_SendSenderAction_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.sendSenderAction(context.Background(), "igid", "tok", "typing_on") }) } func TestInstagramProvider_SendSenderAction_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.sendSenderAction(context.Background(), "igid", "tok", "typing_on") }) } // =========================================================================== // InstagramProvider — ProcessCommentIncoming // =========================================================================== func TestInstagramProvider_ProcessCommentIncoming_NilData_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessCommentIncoming(context.Background(), &model.Inbox{}, nil, EventIGComment) }) } func TestInstagramProvider_ProcessCommentIncoming_NilInbox_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessCommentIncoming(context.Background(), nil, &IGCommentChangeValue{}, EventIGComment) }) } func TestInstagramProvider_ProcessCommentIncoming_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessCommentIncoming(context.Background(), &model.Inbox{}, &IGCommentChangeValue{}, EventIGComment) }) } func TestInstagramProvider_ProcessCommentIncoming_Comment_Cov9(t *testing.T) { p := &InstagramProvider{} data := &IGCommentChangeValue{CommentID: "c1", MediaID: "m1", Text: "hello"} safeCall_Cov9(func() { _, _ = p.ProcessCommentIncoming(context.Background(), &model.Inbox{}, data, EventIGComment) }) } func TestInstagramProvider_ProcessCommentIncoming_Reply_Cov9(t *testing.T) { p := &InstagramProvider{} data := &IGCommentChangeValue{CommentID: "c1", ParentID: "p1", MediaID: "m1", Text: "reply"} safeCall_Cov9(func() { _, _ = p.ProcessCommentIncoming(context.Background(), &model.Inbox{}, data, EventIGCommentReply) }) } func TestInstagramProvider_ProcessCommentIncoming_Deleted_Cov9(t *testing.T) { p := &InstagramProvider{} data := &IGCommentChangeValue{CommentID: "c1", MediaID: "m1"} safeCall_Cov9(func() { _, _ = p.ProcessCommentIncoming(context.Background(), &model.Inbox{}, data, EventIGCommentDeleted) }) } // =========================================================================== // InstagramProvider — Webhook management // =========================================================================== func TestInstagramProvider_RegisterWebhook_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.RegisterWebhook(context.Background(), "tok", "page1") }) } func TestInstagramProvider_RegisterWebhook_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.RegisterWebhook(context.Background(), "tok", "page1") }) } func TestInstagramProvider_ListWebhooks_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ListWebhooks(context.Background(), "tok", "page1") }) } func TestInstagramProvider_ListWebhooks_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ListWebhooks(context.Background(), "tok", "page1") }) } func TestInstagramProvider_DeleteWebhook_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.DeleteWebhook(context.Background(), "tok", "page1") }) } func TestInstagramProvider_DeleteWebhook_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.DeleteWebhook(context.Background(), "tok", "page1") }) } // =========================================================================== // InstagramProvider — Comment API methods // =========================================================================== func TestInstagramProvider_GetComments_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.GetComments(context.Background(), "tok", "media1", 10, "") }) } func TestInstagramProvider_GetComments_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.GetComments(context.Background(), "tok", "media1", 10, "") }) } func TestInstagramProvider_GetCommentReplies_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.GetCommentReplies(context.Background(), "tok", "c1", 10, "") }) } func TestInstagramProvider_GetCommentReplies_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.GetCommentReplies(context.Background(), "tok", "c1", 10, "") }) } func TestInstagramProvider_ReplyToComment_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ReplyToComment(context.Background(), "tok", "c1", "hello") }) } func TestInstagramProvider_ReplyToComment_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.ReplyToComment(context.Background(), "tok", "c1", "hello") }) } func TestInstagramProvider_HideComment_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.HideComment(context.Background(), "tok", "c1", true) }) } func TestInstagramProvider_HideComment_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.HideComment(context.Background(), "tok", "c1", false) }) } func TestInstagramProvider_DeleteComment_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.DeleteComment(context.Background(), "tok", "c1") }) } func TestInstagramProvider_DeleteComment_NoToken_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.DeleteComment(context.Background(), "", "c1") }) } func TestInstagramProvider_DeleteComment_NoID_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.DeleteComment(context.Background(), "tok", "") }) } func TestInstagramProvider_DeleteComment_NilCtx_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.DeleteComment(context.Background(), "tok", "c1") }) } // =========================================================================== // InstagramProvider — combined scenarios // =========================================================================== func TestInstagramProvider_AllIdentityMethods_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.Type() _ = p.Name() _ = p.Description() }) } func TestInstagramProvider_AllConfigMethods_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() _ = p.DefaultConfig() }) } func TestInstagramProvider_AllOAuthMethods_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.OAuthConfig() _, _ = p.BuildAuthURL(context.Background(), 1, "cb") }) } func TestInstagramProvider_CapabilitiesThenConfig_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.Capabilities() _ = p.ConfigSchema() _ = p.DefaultConfig() }) } func TestInstagramProvider_ValidateThenDefault_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), p.DefaultConfig()) }) } func TestInstagramProvider_FullLifecycleFlow_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { cfg := channel.ChannelConfig{"instagram_account_id": "123", "page_access_token": "tok"} _, _ = p.OnCreate(context.Background(), &model.Inbox{}, cfg) _ = p.OnDestroy(context.Background(), &model.Inbox{}, cfg) }) } func TestInstagramProvider_FullWebhookFlow_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { req := &channel.WebhookRequest{ Method: "POST", Headers: map[string]string{"X-Hub-Signature-256": "sha256=abc"}, Body: []byte("{}"), } _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestInstagramProvider_ProcessIGAttachments_Nil_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.processIGAttachments(nil) }) } func TestInstagramProvider_ProcessIGAttachments_Empty_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _ = p.processIGAttachments([]FBAttachment{}) }) } func TestInstagramProvider_ProcessIGAttachments_WithItems_Cov9(t *testing.T) { p := &InstagramProvider{} atts := []FBAttachment{{Type: "image", Payload: FBAttachmentPayload{URL: "http://example.com/img.png"}}} safeCall_Cov9(func() { _ = p.processIGAttachments(atts) }) } // =========================================================================== // InstagramProvider — processIGMessagingEvent (private) // =========================================================================== func TestInstagramProvider_ProcessIGMessagingEvent_NilEvent_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.processIGMessagingEvent(&model.Inbox{}, nil) }) } func TestInstagramProvider_ProcessIGMessagingEvent_NilInbox_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.processIGMessagingEvent(nil, &FBMessagingEvent{}) }) } func TestInstagramProvider_ProcessIGMessagingEvent_EmptyEvent_Cov9(t *testing.T) { p := &InstagramProvider{} safeCall_Cov9(func() { _, _ = p.processIGMessagingEvent(&model.Inbox{}, &FBMessagingEvent{}) }) }