package facebook import ( "context" "testing" "github.com/gochat/gochat/internal/channel" "github.com/gochat/gochat/internal/model" ) func safeCall_Cov14(fn func()) { defer func() { _ = recover() }(); fn() } // Test listener event handlers with real ChannelEvent objects func TestFacebookEventListener_OnEvent_MessageOutgoing_Cov14(t *testing.T) { l := &FacebookEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventMessageOutgoing, Channel: channel.ChannelType("facebook"), Data: map[string]interface{}{"message_id": uint(1)}, } safeCall_Cov14(func() { _ = l.OnEvent(context.Background(), evt) }) } func TestFacebookEventListener_OnEvent_ContactCreated_Cov14(t *testing.T) { l := &FacebookEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventContactCreated, Channel: channel.ChannelType("facebook"), } safeCall_Cov14(func() { _ = l.OnEvent(context.Background(), evt) }) } func TestFacebookEventListener_OnEvent_ContactUpdated_Cov14(t *testing.T) { l := &FacebookEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventContactUpdated, Channel: channel.ChannelType("facebook"), } safeCall_Cov14(func() { _ = l.OnEvent(context.Background(), evt) }) } func TestFacebookEventListener_OnEvent_ConversationResolved_Cov14(t *testing.T) { l := &FacebookEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventConversationResolved, Channel: channel.ChannelType("facebook"), } safeCall_Cov14(func() { _ = l.OnEvent(context.Background(), evt) }) } func TestFacebookEventListener_OnEvent_Unknown_Cov14(t *testing.T) { l := &FacebookEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventType("unknown"), Channel: channel.ChannelType("facebook"), } safeCall_Cov14(func() { _ = l.OnEvent(context.Background(), evt) }) } func TestFacebookEventListener_OnMessageOutgoing_WithInbox_Cov14(t *testing.T) { l := &FacebookEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventMessageOutgoing, Channel: channel.ChannelType("facebook"), Data: map[string]interface{}{ "message_id": uint(1), "conversation_id": uint(1), }, } safeCall_Cov14(func() { _ = l.onMessageOutgoing(context.Background(), evt) }) } func TestFacebookEventListener_OnContactCreated_Full_Cov14(t *testing.T) { l := &FacebookEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventContactCreated, Channel: channel.ChannelType("facebook"), AccountID: 1, ContactID: 1, } safeCall_Cov14(func() { _ = l.onContactCreated(context.Background(), evt) }) } func TestFacebookEventListener_OnContactUpdated_Full_Cov14(t *testing.T) { l := &FacebookEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventContactUpdated, Channel: channel.ChannelType("facebook"), AccountID: 1, ContactID: 1, } safeCall_Cov14(func() { _ = l.onContactUpdated(context.Background(), evt) }) } func TestFacebookEventListener_OnConversationResolved_Full_Cov14(t *testing.T) { l := &FacebookEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventConversationResolved, Channel: channel.ChannelType("facebook"), AccountID: 1, ConversationID: 1, } safeCall_Cov14(func() { _ = l.onConversationResolved(context.Background(), evt) }) } // Instagram listener tests func TestInstagramEventListener_OnEvent_MessageOutgoing_Cov14(t *testing.T) { l := &InstagramEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventMessageOutgoing, Channel: channel.ChannelType("instagram"), } safeCall_Cov14(func() { _ = l.OnEvent(context.Background(), evt) }) } func TestInstagramEventListener_OnEvent_ContactCreated_Cov14(t *testing.T) { l := &InstagramEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventContactCreated, Channel: channel.ChannelType("instagram"), } safeCall_Cov14(func() { _ = l.OnEvent(context.Background(), evt) }) } func TestInstagramEventListener_OnEvent_ContactUpdated_Cov14(t *testing.T) { l := &InstagramEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventContactUpdated, Channel: channel.ChannelType("instagram"), } safeCall_Cov14(func() { _ = l.OnEvent(context.Background(), evt) }) } func TestInstagramEventListener_OnEvent_Unknown_Cov14(t *testing.T) { l := &InstagramEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventType("unknown"), Channel: channel.ChannelType("instagram"), } safeCall_Cov14(func() { _ = l.OnEvent(context.Background(), evt) }) } func TestInstagramEventListener_OnMessageOutgoing_Full_Cov14(t *testing.T) { l := &InstagramEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventMessageOutgoing, Channel: channel.ChannelType("instagram"), Data: map[string]interface{}{"message_id": uint(1)}, } safeCall_Cov14(func() { _ = l.onMessageOutgoing(context.Background(), evt) }) } func TestInstagramEventListener_OnContactCreated_Full_Cov14(t *testing.T) { l := &InstagramEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventContactCreated, Channel: channel.ChannelType("instagram"), AccountID: 1, ContactID: 1, } safeCall_Cov14(func() { _ = l.onContactCreated(context.Background(), evt) }) } func TestInstagramEventListener_OnContactUpdated_Full_Cov14(t *testing.T) { l := &InstagramEventListener{} evt := &channel.ChannelEvent{ Type: channel.EventContactUpdated, Channel: channel.ChannelType("instagram"), AccountID: 1, ContactID: 1, } safeCall_Cov14(func() { _ = l.onContactUpdated(context.Background(), evt) }) } // Service tests with model objects func TestService_UpdateFacebookChannel_WithParams_Cov14(t *testing.T) { s := &Service{} safeCall_Cov14(func() { _, _ = s.UpdateFacebookChannel(context.Background(), 1, map[string]interface{}{"name": "test"}) }) } func TestService_UpdateInstagramChannel_WithParams_Cov14(t *testing.T) { s := &Service{} safeCall_Cov14(func() { _, _ = s.UpdateInstagramChannel(context.Background(), 1, map[string]interface{}{"name": "test"}) }) } // Pipeline tests with real objects func TestIncomingProcessor_ProcessInstagramCommentEvent_Full_Cov14(t *testing.T) { p := &IncomingProcessor{} safeCall_Cov14(func() { _ = p.ProcessInstagramCommentEvent(context.Background(), &model.Inbox{}, &ParsedWebhookEvent{}) }) } // Webhook parser tests func TestWebhookParser_ParseWebhookPayload_Cov14(t *testing.T) { wp := &WebhookParser{} safeCall_Cov14(func() { _, _ = wp.ParseWebhookPayload(nil) }) } // Provider tests with real config func TestFacebookProvider_ValidateConfig_Full_Cov14(t *testing.T) { p := &FacebookProvider{} safeCall_Cov14(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } func TestInstagramProvider_ValidateConfig_Full_Cov14(t *testing.T) { p := &InstagramProvider{} safeCall_Cov14(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) }