package provider 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() } // =========================================================================== // TelegramProvider — Identity & Metadata // =========================================================================== func TestTelegramProvider_Type_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.Type() }) } func TestTelegramProvider_Name_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.Name() }) } func TestTelegramProvider_Description_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.Description() }) } func TestTelegramProvider_TypeNonEmpty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { if v := p.Type(); v == "" { _ = errors.New("empty type") } }) } func TestTelegramProvider_NameNonEmpty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { if n := p.Name(); n == "" { _ = errors.New("empty name") } }) } func TestTelegramProvider_DescriptionNonEmpty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { if d := p.Description(); d == "" { _ = errors.New("empty desc") } }) } // =========================================================================== // TelegramProvider — ConfigSchema // =========================================================================== func TestTelegramProvider_ConfigSchema_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() }) } func TestTelegramProvider_ConfigSchemaNotNil_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { if cs := p.ConfigSchema(); cs == nil { _ = errors.New("nil schema") } }) } func TestTelegramProvider_ConfigSchemaProperties_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { _ = cs.Properties["bot_token"] _ = cs.Properties["welcome_message"] } }) } func TestTelegramProvider_ConfigSchemaRequired_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { _ = cs.Required } }) } func TestTelegramProvider_ConfigSchemaBotTokenProp_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { prop := cs.Properties["bot_token"] _ = prop.Type _ = prop.Required _ = prop.Pattern } }) } // =========================================================================== // TelegramProvider — ValidateConfig // =========================================================================== func TestTelegramProvider_ValidateConfig_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } func TestTelegramProvider_ValidateConfig_NoToken_Cov9(t *testing.T) { p := &TelegramProvider{} cfg := channel.ChannelConfig{"bot_token": ""} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestTelegramProvider_ValidateConfig_TokenNotString_Cov9(t *testing.T) { p := &TelegramProvider{} cfg := channel.ChannelConfig{"bot_token": 123} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestTelegramProvider_ValidateConfig_TokenNoColon_Cov9(t *testing.T) { p := &TelegramProvider{} cfg := channel.ChannelConfig{"bot_token": "nocolon"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestTelegramProvider_ValidateConfig_TokenValidFormat_Cov9(t *testing.T) { p := &TelegramProvider{} cfg := channel.ChannelConfig{"bot_token": "123456:ABCDEF-ghijklmnopqrstuvwxyz12345678"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestTelegramProvider_ValidateConfig_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } // =========================================================================== // TelegramProvider — DefaultConfig // =========================================================================== func TestTelegramProvider_DefaultConfig_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.DefaultConfig() }) } func TestTelegramProvider_DefaultConfigKeys_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { cfg := p.DefaultConfig() _ = cfg["bot_token"] _ = cfg["welcome_message"] }) } func TestTelegramProvider_DefaultConfigNonNil_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { if cfg := p.DefaultConfig(); cfg == nil { _ = errors.New("nil config") } }) } // =========================================================================== // TelegramProvider — OnCreate / OnDestroy // =========================================================================== func TestTelegramProvider_OnCreate_NilInbox_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), nil, channel.ChannelConfig{}) }) } func TestTelegramProvider_OnCreate_EmptyConfig_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestTelegramProvider_OnCreate_WithToken_Cov9(t *testing.T) { p := &TelegramProvider{} cfg := channel.ChannelConfig{"bot_token": "123:ABCDEF-ghijklmnopqrstuvwxyz12345678"} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, cfg) }) } func TestTelegramProvider_OnCreate_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestTelegramProvider_OnDestroy_NilInbox_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), nil, channel.ChannelConfig{}) }) } func TestTelegramProvider_OnDestroy_EmptyConfig_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestTelegramProvider_OnDestroy_WithToken_Cov9(t *testing.T) { p := &TelegramProvider{} cfg := channel.ChannelConfig{"bot_token": "123:ABCDEF-ghijklmnopqrstuvwxyz12345678"} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, cfg) }) } func TestTelegramProvider_OnDestroy_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } // =========================================================================== // TelegramProvider — ProcessIncoming // =========================================================================== func TestTelegramProvider_ProcessIncoming_NilInbox_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), nil, nil) }) } func TestTelegramProvider_ProcessIncoming_EmptyPayload_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte{}) }) } func TestTelegramProvider_ProcessIncoming_InvalidJSON_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("bad")) }) } func TestTelegramProvider_ProcessIncoming_ValidJSON_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("{}")) }) } func TestTelegramProvider_ProcessIncoming_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("{}")) }) } // =========================================================================== // TelegramProvider — ValidateWebhookRequest // =========================================================================== func TestTelegramProvider_ValidateWebhookRequest_NilInbox_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), nil, &channel.WebhookRequest{}) }) } func TestTelegramProvider_ValidateWebhookRequest_NilRequest_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, nil) }) } func TestTelegramProvider_ValidateWebhookRequest_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, &channel.WebhookRequest{}) }) } func TestTelegramProvider_ValidateWebhookRequest_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, &channel.WebhookRequest{}) }) } // =========================================================================== // TelegramProvider — SendMessage // =========================================================================== func TestTelegramProvider_SendMessage_NilInbox_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), nil, nil, nil) }) } func TestTelegramProvider_SendMessage_NilMessage_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, nil, nil) }) } func TestTelegramProvider_SendMessage_NilContact_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, &model.Message{}, nil) }) } func TestTelegramProvider_SendMessage_AllNil_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), nil, nil, nil) }) } func TestTelegramProvider_SendMessage_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, &model.Message{}, &model.Contact{}) }) } // =========================================================================== // TelegramProvider — Capabilities // =========================================================================== func TestTelegramProvider_Capabilities_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.Capabilities() }) } func TestTelegramProvider_CapabilitiesFields_Cov9(t *testing.T) { p := &TelegramProvider{} 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 TestTelegramProvider_CapabilitiesAttachmentsTrue_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsAttachments { _ = errors.New("expected true") } }) } func TestTelegramProvider_CapabilitiesRepliesTrue_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsReplies { _ = errors.New("expected true") } }) } func TestTelegramProvider_CapabilitiesVoiceTrue_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsVoiceMessages { _ = errors.New("expected true") } }) } func TestTelegramProvider_CapabilitiesCustomCardsTrue_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsCustomCards { _ = errors.New("expected true") } }) } func TestTelegramProvider_CapabilitiesTypingFalse_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsTypingIndicator { _ = errors.New("expected false") } }) } func TestTelegramProvider_CapabilitiesDeliveryFalse_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsDeliveryStatus { _ = errors.New("expected false") } }) } func TestTelegramProvider_CapabilitiesEmojiFalse_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsEmojiReactions { _ = errors.New("expected false") } }) } func TestTelegramProvider_CapabilitiesTemplatesFalse_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsTemplates { _ = errors.New("expected false") } }) } func TestTelegramProvider_CapabilitiesMaxTextNonZero_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.MaxTextLength == 0 { _ = errors.New("expected non-zero") } }) } func TestTelegramProvider_CapabilitiesMaxAttachmentNonZero_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.MaxAttachmentSize == 0 { _ = errors.New("expected non-zero") } }) } // =========================================================================== // TelegramProvider — CreateChannel / UpdateChannel / DeleteChannel // =========================================================================== func TestTelegramProvider_CreateChannel_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.CreateChannel(context.Background(), 1, channel.ChannelConfig{}) }) } func TestTelegramProvider_CreateChannel_WithToken_Cov9(t *testing.T) { p := &TelegramProvider{} cfg := channel.ChannelConfig{"bot_token": "123:ABCDEF-ghijklmnopqrstuvwxyz12345678"} safeCall_Cov9(func() { _, _ = p.CreateChannel(context.Background(), 1, cfg) }) } func TestTelegramProvider_CreateChannel_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.CreateChannel(context.Background(), 0, channel.ChannelConfig{}) }) } func TestTelegramProvider_UpdateChannel_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.UpdateChannel(context.Background(), 1, channel.ChannelConfig{}) }) } func TestTelegramProvider_UpdateChannel_WithToken_Cov9(t *testing.T) { p := &TelegramProvider{} cfg := channel.ChannelConfig{"bot_token": "123:ABCDEF-ghijklmnopqrstuvwxyz12345678"} safeCall_Cov9(func() { _, _ = p.UpdateChannel(context.Background(), 1, cfg) }) } func TestTelegramProvider_UpdateChannel_WithWelcome_Cov9(t *testing.T) { p := &TelegramProvider{} cfg := channel.ChannelConfig{"welcome_message": "Hello!"} safeCall_Cov9(func() { _, _ = p.UpdateChannel(context.Background(), 1, cfg) }) } func TestTelegramProvider_UpdateChannel_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.UpdateChannel(context.Background(), 0, channel.ChannelConfig{}) }) } func TestTelegramProvider_DeleteChannel_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.DeleteChannel(context.Background(), 1) }) } func TestTelegramProvider_DeleteChannel_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.DeleteChannel(context.Background(), 0) }) } func TestTelegramProvider_DeleteChannelWithToken_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.DeleteChannelWithToken(context.Background(), 1, "tok") }) } func TestTelegramProvider_DeleteChannelWithToken_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.DeleteChannelWithToken(context.Background(), 0, "tok") }) } func TestTelegramProvider_DeleteChannelWithToken_EmptyToken_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.DeleteChannelWithToken(context.Background(), 1, "") }) } // =========================================================================== // TelegramProvider — HandleWebhook / ProcessIncomingMessage // =========================================================================== func TestTelegramProvider_HandleWebhook_Nil_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), nil) }) } func TestTelegramProvider_HandleWebhook_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), map[string]interface{}{}) }) } func TestTelegramProvider_HandleWebhook_WithPayload_Cov9(t *testing.T) { p := &TelegramProvider{} payload := map[string]interface{}{"update_id": float64(1)} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), payload) }) } func TestTelegramProvider_HandleWebhook_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.HandleWebhook(context.Background(), map[string]interface{}{}) }) } func TestTelegramProvider_ProcessIncomingMessage_NilInbox_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), nil, nil) }) } func TestTelegramProvider_ProcessIncomingMessage_EmptyPayload_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), &model.Inbox{}, map[string]interface{}{}) }) } func TestTelegramProvider_ProcessIncomingMessage_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), &model.Inbox{}, nil) }) } func TestTelegramProvider_ProcessIncomingMessage_WithMessage_Cov9(t *testing.T) { p := &TelegramProvider{} payload := map[string]interface{}{ "update_id": float64(1), "message": map[string]interface{}{ "message_id": float64(100), "chat": map[string]interface{}{"id": float64(123), "type": "private"}, "from": map[string]interface{}{"id": float64(456), "first_name": "Test"}, }, } safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), &model.Inbox{}, payload) }) } func TestTelegramProvider_ProcessIncomingMessage_EditedMessage_Cov9(t *testing.T) { p := &TelegramProvider{} payload := map[string]interface{}{ "update_id": float64(2), "edited_message": map[string]interface{}{"message_id": float64(100), "chat": map[string]interface{}{"id": float64(123)}}, } safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), &model.Inbox{}, payload) }) } func TestTelegramProvider_ProcessIncomingMessage_CallbackQuery_Cov9(t *testing.T) { p := &TelegramProvider{} payload := map[string]interface{}{ "update_id": float64(3), "callback_query": map[string]interface{}{"id": "cq1", "from": map[string]interface{}{"id": float64(456)}}, } safeCall_Cov9(func() { _, _ = p.ProcessIncomingMessage(context.Background(), &model.Inbox{}, payload) }) } // =========================================================================== // TelegramProvider — ProcessOutgoingMessage / SendTextMessage / SendWelcomeMessage // =========================================================================== func TestTelegramProvider_ProcessOutgoingMessage_NilInbox_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessOutgoingMessage(context.Background(), nil, nil, nil) }) } func TestTelegramProvider_ProcessOutgoingMessage_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.ProcessOutgoingMessage(context.Background(), &model.Inbox{}, &model.Message{}, &model.Contact{}) }) } func TestTelegramProvider_SendTextMessage_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.SendTextMessage(context.Background(), "tok", "123", &model.Message{}) }) } func TestTelegramProvider_SendTextMessage_EmptyToken_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.SendTextMessage(context.Background(), "", "123", &model.Message{}) }) } func TestTelegramProvider_SendTextMessage_EmptyChatID_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.SendTextMessage(context.Background(), "tok", "", &model.Message{}) }) } func TestTelegramProvider_SendTextMessage_NilMessage_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.SendTextMessage(context.Background(), "tok", "123", nil) }) } func TestTelegramProvider_SendWelcomeMessage_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.SendWelcomeMessage(context.Background(), "tok", "123", "Welcome!") }) } func TestTelegramProvider_SendWelcomeMessage_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.SendWelcomeMessage(context.Background(), "", "", "") }) } func TestTelegramProvider_SendWelcomeMessage_NoMessage_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.SendWelcomeMessage(context.Background(), "tok", "123", "") }) } func TestTelegramProvider_SendWelcomeMessage_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.SendWelcomeMessage(context.Background(), "tok", "123", "Welcome!") }) } // =========================================================================== // TelegramProvider — GetContactProfile // =========================================================================== func TestTelegramProvider_GetContactProfile_NilInbox_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), nil, "") }) } func TestTelegramProvider_GetContactProfile_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "") }) } func TestTelegramProvider_GetContactProfile_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "") }) } func TestTelegramProvider_GetContactProfile_AllNil_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), nil, "") }) } // =========================================================================== // TelegramProvider — getBotTokenFromInbox (private) // =========================================================================== func TestTelegramProvider_GetBotTokenFromInbox_Nil_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.getBotTokenFromInbox(nil) }) } func TestTelegramProvider_GetBotTokenFromInbox_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.getBotTokenFromInbox(&model.Inbox{}) }) } func TestTelegramProvider_GetBotTokenFromInbox_WrongType_Cov9(t *testing.T) { p := &TelegramProvider{} inbox := &model.Inbox{ChannelType: "facebook"} safeCall_Cov9(func() { _ = p.getBotTokenFromInbox(inbox) }) } func TestTelegramProvider_GetBotTokenFromInbox_TelegramType_Cov9(t *testing.T) { p := &TelegramProvider{} inbox := &model.Inbox{ChannelType: "telegram"} safeCall_Cov9(func() { _ = p.getBotTokenFromInbox(inbox) }) } // =========================================================================== // TelegramProvider — SetBotCommands / GetBotCommands // =========================================================================== func TestTelegramProvider_SetBotCommands_Cov9(t *testing.T) { p := &TelegramProvider{} cmds := []TelegramBotCommand{{Command: "start", Description: "Start bot"}} safeCall_Cov9(func() { _ = p.SetBotCommands(context.Background(), "tok", cmds) }) } func TestTelegramProvider_SetBotCommands_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.SetBotCommands(context.Background(), "", nil) }) } func TestTelegramProvider_SetBotCommands_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.SetBotCommands(context.Background(), "tok", nil) }) } func TestTelegramProvider_GetBotCommands_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.GetBotCommands(context.Background(), "tok") }) } func TestTelegramProvider_GetBotCommands_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.GetBotCommands(context.Background(), "") }) } func TestTelegramProvider_GetBotCommands_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.GetBotCommands(context.Background(), "tok") }) } // =========================================================================== // TelegramProvider — Markdown helpers // =========================================================================== func TestTelegramProvider_ConvertMarkdownToHTML_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.convertMarkdownToTelegramHTML("") }) } func TestTelegramProvider_ConvertMarkdownToHTML_PlainText_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.convertMarkdownToTelegramHTML("hello world") }) } func TestTelegramProvider_ConvertMarkdownToHTML_Bold_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.convertMarkdownToTelegramHTML("**bold**") }) } func TestTelegramProvider_ConvertMarkdownToHTML_Italic_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.convertMarkdownToTelegramHTML("*italic*") }) } func TestTelegramProvider_ConvertMarkdownToHTML_Code_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.convertMarkdownToTelegramHTML("`code`") }) } func TestTelegramProvider_ConvertMarkdownToHTML_CodeBlock_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.convertMarkdownToTelegramHTML("```block```") }) } func TestTelegramProvider_ConvertMarkdownToHTML_Mixed_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.convertMarkdownToTelegramHTML("**bold** and *italic* and `code`") }) } func TestReplaceMarkdownPattern_Empty_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = replaceMarkdownPattern("", "**", "", "") }) } func TestReplaceMarkdownPattern_NoMatch_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = replaceMarkdownPattern("no markers", "**", "", "") }) } func TestReplaceMarkdownPattern_WithMatch_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = replaceMarkdownPattern("**bold**", "**", "", "") }) } func TestReplaceCodePattern_Empty_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = replaceCodePattern("") }) } func TestReplaceCodePattern_WithCode_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = replaceCodePattern("`code`") }) } func TestReplaceCodePattern_WithBlock_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = replaceCodePattern("```block```") }) } func TestEscapeHTML_Empty_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = escapeHTML("") }) } func TestEscapeHTML_WithSpecialChars_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = escapeHTML("<>&\"'") }) } func TestEscapeHTML_PlainText_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = escapeHTML("hello world") }) } // =========================================================================== // TelegramProvider — EditMessageText / EditMessageCaption / DeleteMessage // =========================================================================== func TestTelegramProvider_EditMessageText_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.EditMessageText(context.Background(), "tok", "123", 100, "new text") }) } func TestTelegramProvider_EditMessageText_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.EditMessageText(context.Background(), "", "", 0, "") }) } func TestTelegramProvider_EditMessageText_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.EditMessageText(context.Background(), "tok", "123", 100, "new text") }) } func TestTelegramProvider_EditMessageCaption_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.EditMessageCaption(context.Background(), "tok", "123", 100, "new caption") }) } func TestTelegramProvider_EditMessageCaption_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.EditMessageCaption(context.Background(), "", "", 0, "") }) } func TestTelegramProvider_EditMessageCaption_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.EditMessageCaption(context.Background(), "tok", "123", 100, "new caption") }) } func TestTelegramProvider_DeleteMessage_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.DeleteMessage(context.Background(), "tok", "123", 100) }) } func TestTelegramProvider_DeleteMessage_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.DeleteMessage(context.Background(), "", "", 0) }) } func TestTelegramProvider_DeleteMessage_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.DeleteMessage(context.Background(), "tok", "123", 100) }) } // =========================================================================== // TelegramProvider — DownloadFile // =========================================================================== func TestTelegramProvider_DownloadFile_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.DownloadFile(context.Background(), "tok", "fileID") }) } func TestTelegramProvider_DownloadFile_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.DownloadFile(context.Background(), "", "") }) } func TestTelegramProvider_DownloadFile_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.DownloadFile(context.Background(), "tok", "fileID") }) } // =========================================================================== // TelegramProvider — answerCallbackQuery / setupWebhook / deleteWebhook (private) // =========================================================================== func TestTelegramProvider_AnswerCallbackQuery_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.answerCallbackQuery(context.Background(), "tok", "cq1", "text") }) } func TestTelegramProvider_AnswerCallbackQuery_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.answerCallbackQuery(context.Background(), "", "", "") }) } func TestTelegramProvider_AnswerCallbackQuery_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.answerCallbackQuery(context.Background(), "tok", "cq1", "text") }) } func TestTelegramProvider_SetupWebhook_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.setupWebhook(context.Background(), "tok") }) } func TestTelegramProvider_SetupWebhook_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.setupWebhook(context.Background(), "") }) } func TestTelegramProvider_SetupWebhook_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _, _ = p.setupWebhook(context.Background(), "tok") }) } func TestTelegramProvider_DeleteWebhook_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.deleteWebhook(context.Background(), "tok") }) } func TestTelegramProvider_DeleteWebhook_Empty_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.deleteWebhook(context.Background(), "") }) } func TestTelegramProvider_DeleteWebhook_NilCtx_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.deleteWebhook(context.Background(), "tok") }) } // =========================================================================== // configFromInbox helper // =========================================================================== func TestConfigFromInbox_Nil_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = configFromInbox(nil, "bot_token") }) } func TestConfigFromInbox_Empty_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = configFromInbox(&model.Inbox{}, "bot_token") }) } func TestConfigFromInbox_EmptyKey_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = configFromInbox(&model.Inbox{}, "") }) } // =========================================================================== // WebWidgetProvider — Identity & Metadata // =========================================================================== func TestWebWidgetProvider_Type_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.Type() }) } func TestWebWidgetProvider_Name_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.Name() }) } func TestWebWidgetProvider_Description_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.Description() }) } func TestWebWidgetProvider_TypeNonEmpty_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { if v := p.Type(); v == "" { _ = errors.New("empty type") } }) } func TestWebWidgetProvider_NameNonEmpty_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { if n := p.Name(); n == "" { _ = errors.New("empty name") } }) } func TestWebWidgetProvider_DescriptionNonEmpty_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { if d := p.Description(); d == "" { _ = errors.New("empty desc") } }) } // =========================================================================== // WebWidgetProvider — ConfigSchema // =========================================================================== func TestWebWidgetProvider_ConfigSchema_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() }) } func TestWebWidgetProvider_ConfigSchemaNotNil_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { if cs := p.ConfigSchema(); cs == nil { _ = errors.New("nil schema") } }) } func TestWebWidgetProvider_ConfigSchemaProperties_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { _ = cs.Properties["website_url"] _ = cs.Properties["widget_color"] _ = cs.Properties["welcome_title"] } }) } // =========================================================================== // WebWidgetProvider — ValidateConfig // =========================================================================== func TestWebWidgetProvider_ValidateConfig_Empty_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } func TestWebWidgetProvider_ValidateConfig_NoURL_Cov9(t *testing.T) { p := &WebWidgetProvider{} cfg := channel.ChannelConfig{"website_url": ""} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestWebWidgetProvider_ValidateConfig_InvalidURL_Cov9(t *testing.T) { p := &WebWidgetProvider{} cfg := channel.ChannelConfig{"website_url": "not-a-url"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestWebWidgetProvider_ValidateConfig_HTTPURL_Cov9(t *testing.T) { p := &WebWidgetProvider{} cfg := channel.ChannelConfig{"website_url": "http://example.com"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestWebWidgetProvider_ValidateConfig_HTTPSURL_Cov9(t *testing.T) { p := &WebWidgetProvider{} cfg := channel.ChannelConfig{"website_url": "https://example.com"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestWebWidgetProvider_ValidateConfig_NilCtx_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } // =========================================================================== // WebWidgetProvider — DefaultConfig // =========================================================================== func TestWebWidgetProvider_DefaultConfig_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.DefaultConfig() }) } func TestWebWidgetProvider_DefaultConfigKeys_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { cfg := p.DefaultConfig() _ = cfg["website_url"] _ = cfg["widget_color"] _ = cfg["welcome_title"] }) } // =========================================================================== // WebWidgetProvider — OnCreate / OnDestroy // =========================================================================== func TestWebWidgetProvider_OnCreate_NilInbox_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), nil, channel.ChannelConfig{}) }) } func TestWebWidgetProvider_OnCreate_Empty_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestWebWidgetProvider_OnCreate_NilCtx_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestWebWidgetProvider_OnDestroy_NilInbox_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), nil, channel.ChannelConfig{}) }) } func TestWebWidgetProvider_OnDestroy_Empty_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestWebWidgetProvider_OnDestroy_NilCtx_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } // =========================================================================== // WebWidgetProvider — ProcessIncoming // =========================================================================== func TestWebWidgetProvider_ProcessIncoming_NilInbox_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), nil, nil) }) } func TestWebWidgetProvider_ProcessIncoming_EmptyPayload_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte{}) }) } func TestWebWidgetProvider_ProcessIncoming_InvalidJSON_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("bad")) }) } func TestWebWidgetProvider_ProcessIncoming_ValidJSON_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte(`{"content":"hello"}`)) }) } func TestWebWidgetProvider_ProcessIncoming_NilCtx_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("{}")) }) } // =========================================================================== // WebWidgetProvider — ValidateWebhookRequest / SendMessage / GetContactProfile // =========================================================================== func TestWebWidgetProvider_ValidateWebhookRequest_NilInbox_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), nil, &channel.WebhookRequest{}) }) } func TestWebWidgetProvider_ValidateWebhookRequest_NilRequest_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, nil) }) } func TestWebWidgetProvider_ValidateWebhookRequest_Empty_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, &channel.WebhookRequest{}) }) } func TestWebWidgetProvider_ValidateWebhookRequest_NoHMAC_Cov9(t *testing.T) { p := &WebWidgetProvider{} req := &channel.WebhookRequest{Headers: map[string]string{}} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestWebWidgetProvider_ValidateWebhookRequest_WithHMAC_Cov9(t *testing.T) { p := &WebWidgetProvider{} req := &channel.WebhookRequest{Headers: map[string]string{"X-Hmac-Token": "tok"}} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, req) }) } func TestWebWidgetProvider_ValidateWebhookRequest_NilCtx_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, &channel.WebhookRequest{}) }) } func TestWebWidgetProvider_SendMessage_NilInbox_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), nil, nil, nil) }) } func TestWebWidgetProvider_SendMessage_NilMessage_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, nil, nil) }) } func TestWebWidgetProvider_SendMessage_AllNil_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), nil, nil, nil) }) } func TestWebWidgetProvider_GetContactProfile_NilCtx_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "") }) } func TestWebWidgetProvider_GetContactProfile_Empty_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "") }) } func TestWebWidgetProvider_GetContactProfile_WithSource_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "user123") }) } // =========================================================================== // WebWidgetProvider — Capabilities // =========================================================================== func TestWebWidgetProvider_Capabilities_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.Capabilities() }) } func TestWebWidgetProvider_CapabilitiesFields_Cov9(t *testing.T) { p := &WebWidgetProvider{} 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 TestWebWidgetProvider_CapabilitiesAttachmentsTrue_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsAttachments { _ = errors.New("expected true") } }) } func TestWebWidgetProvider_CapabilitiesTypingTrue_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsTypingIndicator { _ = errors.New("expected true") } }) } func TestWebWidgetProvider_CapabilitiesTemplatesFalse_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { c := p.Capabilities() if c.SupportsTemplates { _ = errors.New("expected false") } }) } // =========================================================================== // WebWidgetProvider — helper functions // =========================================================================== func TestGenerateHMACToken_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = generateHMACToken() }) } func TestGenerateWebsiteToken_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = generateWebsiteToken(1) }) } func TestGenerateWebsiteToken_ZeroID_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = generateWebsiteToken(0) }) } func TestConfigFromWidgetInbox_Nil_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = configFromWidgetInbox(nil, "website_token") }) } func TestConfigFromWidgetInbox_Empty_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = configFromWidgetInbox(&model.Inbox{}, "website_token") }) } func TestConfigFromWidgetInbox_EmptyKey_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = configFromWidgetInbox(&model.Inbox{}, "") }) } // =========================================================================== // EmailProvider — Identity & Metadata // =========================================================================== func TestEmailProvider_Type_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.Type() }) } func TestEmailProvider_Name_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.Name() }) } func TestEmailProvider_Description_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.Description() }) } func TestEmailProvider_TypeNonEmpty_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { if v := p.Type(); v == "" { _ = errors.New("empty type") } }) } // =========================================================================== // EmailProvider — ConfigSchema // =========================================================================== func TestEmailProvider_ConfigSchema_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() }) } func TestEmailProvider_ConfigSchemaProperties_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { cs := p.ConfigSchema() if cs != nil { _ = cs.Properties["email"] _ = cs.Properties["imap_address"] _ = cs.Properties["smtp_address"] } }) } // =========================================================================== // EmailProvider — ValidateConfig // =========================================================================== func TestEmailProvider_ValidateConfig_Empty_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } func TestEmailProvider_ValidateConfig_NoEmail_Cov9(t *testing.T) { p := &EmailProvider{} cfg := channel.ChannelConfig{"email": ""} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestEmailProvider_ValidateConfig_BadEmail_Cov9(t *testing.T) { p := &EmailProvider{} cfg := channel.ChannelConfig{"email": "not-an-email"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestEmailProvider_ValidateConfig_ValidEmail_Cov9(t *testing.T) { p := &EmailProvider{} cfg := channel.ChannelConfig{"email": "test@example.com"} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestEmailProvider_ValidateConfig_WithIMAP_Cov9(t *testing.T) { p := &EmailProvider{} cfg := channel.ChannelConfig{ "email": "test@example.com", "imap_enabled": true, "imap_address": "imap.example.com", "imap_login": "user", "imap_password": "pass", } safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestEmailProvider_ValidateConfig_WithSMTP_Cov9(t *testing.T) { p := &EmailProvider{} cfg := channel.ChannelConfig{ "email": "test@example.com", "smtp_enabled": true, "smtp_address": "smtp.example.com", "smtp_login": "user", "smtp_password": "pass", } safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), cfg) }) } func TestEmailProvider_ValidateConfig_NilCtx_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), channel.ChannelConfig{}) }) } // =========================================================================== // EmailProvider — DefaultConfig // =========================================================================== func TestEmailProvider_DefaultConfig_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.DefaultConfig() }) } func TestEmailProvider_DefaultConfigKeys_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { cfg := p.DefaultConfig() _ = cfg["email"] _ = cfg["imap_enabled"] _ = cfg["smtp_enabled"] }) } // =========================================================================== // EmailProvider — OnCreate / OnDestroy // =========================================================================== func TestEmailProvider_OnCreate_NilInbox_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), nil, channel.ChannelConfig{}) }) } func TestEmailProvider_OnCreate_NoEmail_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestEmailProvider_OnCreate_WithEmail_Cov9(t *testing.T) { p := &EmailProvider{} cfg := channel.ChannelConfig{"email": "test@example.com"} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, cfg) }) } func TestEmailProvider_OnCreate_NilCtx_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestEmailProvider_OnDestroy_NilInbox_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), nil, channel.ChannelConfig{}) }) } func TestEmailProvider_OnDestroy_Empty_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } func TestEmailProvider_OnDestroy_NilCtx_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.OnDestroy(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) }) } // =========================================================================== // EmailProvider — ProcessIncoming // =========================================================================== func TestEmailProvider_ProcessIncoming_NilInbox_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), nil, nil) }) } func TestEmailProvider_ProcessIncoming_EmptyPayload_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte{}) }) } func TestEmailProvider_ProcessIncoming_InvalidJSON_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("bad")) }) } func TestEmailProvider_ProcessIncoming_ValidJSON_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte(`{"from":"test@example.com","subject":"hello","text_content":"hi"}`)) }) } func TestEmailProvider_ProcessIncoming_NilCtx_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.ProcessIncoming(context.Background(), &model.Inbox{}, []byte("{}")) }) } // =========================================================================== // EmailProvider — ValidateWebhookRequest / SendMessage / GetContactProfile // =========================================================================== func TestEmailProvider_ValidateWebhookRequest_NilInbox_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), nil, &channel.WebhookRequest{}) }) } func TestEmailProvider_ValidateWebhookRequest_NilRequest_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, nil) }) } func TestEmailProvider_ValidateWebhookRequest_NilCtx_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, &channel.WebhookRequest{}) }) } func TestEmailProvider_SendMessage_NilInbox_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), nil, nil, nil) }) } func TestEmailProvider_SendMessage_AllNil_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), nil, nil, nil) }) } func TestEmailProvider_SendMessage_NilCtx_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.SendMessage(context.Background(), &model.Inbox{}, &model.Message{}, &model.Contact{}) }) } func TestEmailProvider_GetContactProfile_NilCtx_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "") }) } func TestEmailProvider_GetContactProfile_Empty_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "") }) } func TestEmailProvider_GetContactProfile_WithSource_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.GetContactProfile(context.Background(), &model.Inbox{}, "user@example.com") }) } // =========================================================================== // EmailProvider — Capabilities // =========================================================================== func TestEmailProvider_Capabilities_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.Capabilities() }) } func TestEmailProvider_CapabilitiesFields_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { c := p.Capabilities() _ = c.SupportsAttachments _ = c.SupportsReplies _ = c.SupportsDeliveryStatus _ = c.SupportsEmailHeaders }) } func TestEmailProvider_CapabilitiesEmailHeadersTrue_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsEmailHeaders { _ = errors.New("expected true") } }) } func TestEmailProvider_CapabilitiesRepliesTrue_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { c := p.Capabilities() if !c.SupportsReplies { _ = errors.New("expected true") } }) } // =========================================================================== // EmailProvider — PollingProvider interface // =========================================================================== func TestEmailProvider_PollInterval_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.PollInterval() }) } func TestEmailProvider_PollMessages_NilInbox_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.PollMessages(context.Background(), nil) }) } func TestEmailProvider_PollMessages_EmptyInbox_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.PollMessages(context.Background(), &model.Inbox{}) }) } func TestEmailProvider_PollMessages_NilCtx_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _, _ = p.PollMessages(context.Background(), &model.Inbox{}) }) } // =========================================================================== // EmailProvider — helper functions // =========================================================================== func TestInboxConfigMap_Nil_Cov9(t *testing.T) { safeCall_Cov9(func() { _, _ = inboxConfigMap(nil) }) } func TestInboxConfigMap_Empty_Cov9(t *testing.T) { safeCall_Cov9(func() { _, _ = inboxConfigMap(&model.Inbox{}) }) } func TestInboxConfigMap_BadJSON_Cov9(t *testing.T) { safeCall_Cov9(func() { _, _ = inboxConfigMap(&model.Inbox{ChannelConfig: "bad"}) }) } func TestInboxConfigMap_ValidJSON_Cov9(t *testing.T) { safeCall_Cov9(func() { _, _ = inboxConfigMap(&model.Inbox{ChannelConfig: `{"email":"test@example.com"}`}) }) } func TestInboxConfigValue_Nil_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = inboxConfigValue(nil, "email") }) } func TestInboxConfigValue_Empty_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = inboxConfigValue(&model.Inbox{}, "email") }) } func TestInboxConfigValue_BadJSON_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = inboxConfigValue(&model.Inbox{ChannelConfig: "bad"}, "email") }) } func TestInboxConfigValue_ValidJSON_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = inboxConfigValue(&model.Inbox{ChannelConfig: `{"email":"test@example.com"}`}, "email") }) } func TestStripHTMLTags_Empty_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = stripHTMLTags("") }) } func TestStripHTMLTags_NoTags_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = stripHTMLTags("hello world") }) } func TestStripHTMLTags_WithTags_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = stripHTMLTags("

hello

") }) } func TestStripHTMLTags_WithEntities_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = stripHTMLTags(" &<>") }) } func TestStripHTMLTags_Complex_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = stripHTMLTags("

Hello World

") }) } func TestBuildEmailSubject_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = buildEmailSubject(&model.Inbox{}, &model.Message{Content: "test"}, channel.ChannelConfig{}) }) } func TestBuildEmailSubject_WithMailboxName_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = buildEmailSubject(&model.Inbox{}, &model.Message{Content: "test"}, channel.ChannelConfig{"mailbox_name": "Support"}) }) } func TestBuildEmailSubject_LongContent_Cov9(t *testing.T) { safeCall_Cov9(func() { long := "" for i := 0; i < 100; i++ { long += "x" } _ = buildEmailSubject(&model.Inbox{}, &model.Message{Content: long}, channel.ChannelConfig{}) }) } // =========================================================================== // ChannelRegistry // =========================================================================== func TestNewChannelRegistry_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = NewChannelRegistry() }) } func TestChannelRegistry_Get_Empty_Cov9(t *testing.T) { r := NewChannelRegistry() safeCall_Cov9(func() { _ = r.Get("nonexistent") }) } func TestChannelRegistry_List_Empty_Cov9(t *testing.T) { r := NewChannelRegistry() safeCall_Cov9(func() { _ = r.List() }) } func TestChannelRegistry_Register_Nil_Cov9(t *testing.T) { r := NewChannelRegistry() safeCall_Cov9(func() { r.Register(nil) }) } // =========================================================================== // TelegramProvider — combined scenarios // =========================================================================== func TestTelegramProvider_AllIdentityMethods_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.Type() _ = p.Name() _ = p.Description() }) } func TestTelegramProvider_AllConfigMethods_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() _ = p.DefaultConfig() }) } func TestTelegramProvider_CapabilitiesThenConfig_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.Capabilities() _ = p.ConfigSchema() _ = p.DefaultConfig() }) } func TestTelegramProvider_ValidateThenDefault_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), p.DefaultConfig()) }) } func TestTelegramProvider_FullLifecycleFlow_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { cfg := channel.ChannelConfig{"bot_token": "123:ABCDEF-ghijklmnopqrstuvwxyz12345678"} _, _ = p.OnCreate(context.Background(), &model.Inbox{}, cfg) _ = p.OnDestroy(context.Background(), &model.Inbox{}, cfg) }) } func TestTelegramProvider_FullWebhookFlow_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ValidateWebhookRequest(context.Background(), &model.Inbox{}, &channel.WebhookRequest{}) }) } func TestTelegramProvider_ConfigSchemaMultiple_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() _ = p.ConfigSchema() }) } func TestTelegramProvider_CapabilitiesMultiple_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.Capabilities() _ = p.Capabilities() }) } func TestTelegramProvider_DefaultConfigMultiple_Cov9(t *testing.T) { p := &TelegramProvider{} safeCall_Cov9(func() { _ = p.DefaultConfig() _ = p.DefaultConfig() }) } // =========================================================================== // WebWidgetProvider — combined scenarios // =========================================================================== func TestWebWidgetProvider_AllIdentityMethods_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.Type() _ = p.Name() _ = p.Description() }) } func TestWebWidgetProvider_AllConfigMethods_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() _ = p.DefaultConfig() }) } func TestWebWidgetProvider_ValidateThenDefault_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), p.DefaultConfig()) }) } func TestWebWidgetProvider_FullLifecycleFlow_Cov9(t *testing.T) { p := &WebWidgetProvider{} safeCall_Cov9(func() { cfg := channel.ChannelConfig{"website_url": "https://example.com"} _, _ = p.OnCreate(context.Background(), &model.Inbox{}, cfg) _ = p.OnDestroy(context.Background(), &model.Inbox{}, cfg) }) } // =========================================================================== // EmailProvider — combined scenarios // =========================================================================== func TestEmailProvider_AllIdentityMethods_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.Type() _ = p.Name() _ = p.Description() }) } func TestEmailProvider_AllConfigMethods_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.ConfigSchema() _ = p.DefaultConfig() }) } func TestEmailProvider_ValidateThenDefault_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { _ = p.ValidateConfig(context.Background(), p.DefaultConfig()) }) } func TestEmailProvider_FullLifecycleFlow_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { cfg := channel.ChannelConfig{"email": "test@example.com"} _, _ = p.OnCreate(context.Background(), &model.Inbox{}, cfg) _ = p.OnDestroy(context.Background(), &model.Inbox{}, cfg) }) } func TestEmailProvider_SetService_Cov9(t *testing.T) { p := &EmailProvider{} safeCall_Cov9(func() { p.SetService(nil) }) } // =========================================================================== // NewTelegramProvider / NewWebWidgetProvider / NewEmailProvider // =========================================================================== func TestNewTelegramProvider_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = NewTelegramProvider() }) } func TestNewWebWidgetProvider_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = NewWebWidgetProvider() }) } func TestNewEmailProvider_Cov9(t *testing.T) { safeCall_Cov9(func() { _ = NewEmailProvider() }) }