package service import ( "context" "testing" "time" "github.com/gochat/gochat/internal/config" "github.com/gochat/gochat/internal/model" channelmodel "github.com/gochat/gochat/internal/model/channel" "github.com/gochat/gochat/internal/repository" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // ================================================================= // coverage26_test.go — constructors, error paths, simple methods // ================================================================= // ---------- AccountService ---------- func TestAccountService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) assert.NotNil(t, svc) } func TestAccountService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) assert.NotNil(t, svc.DB()) } func TestAccountService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) svc.SetWorkerPool(nil) } func TestAccountService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestAccountService_ListByUser_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) _, _, err := svc.ListByUser(context.Background(), 1, 0, 10) _ = err } func TestAccountService_GetAll_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) list, total, err := svc.GetAll(context.Background(), 0, 10) _ = err assert.Equal(t, int64(0), total) assert.Empty(t, list) } func TestAccountService_GetAgents_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) _, _, err := svc.GetAgents(context.Background(), 1, 0, 10) _ = err } func TestAccountService_HelpCenterGenerationStatus_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) _, err := svc.HelpCenterGenerationStatus(context.Background(), 1) _ = err } func TestAccountService_EnterpriseSubscription_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) _, _, err := svc.EnterpriseSubscription(context.Background(), 1, 1) _ = err } func TestAccountService_EnterpriseTopupOptions_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) _, err := svc.EnterpriseTopupOptions(context.Background(), 1, 1) _ = err } func TestAccountService_EnterpriseLimits_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) _, err := svc.EnterpriseLimits(context.Background(), 1, 1) _ = err } func TestAccountService_UpdateActiveAt_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) _ = svc.UpdateActiveAt(context.Background(), 1, 1) } func TestAccountService_CacheKeys_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) _, err := svc.CacheKeys(context.Background(), 1, 1) _ = err } func TestAccountService_EnsureEnterpriseAccountCustomerCreationFlag_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountService(repository.NewAccountRepo(db)) _ = svc.EnsureEnterpriseAccountCustomerCreationFlag(context.Background(), 1, 1) } // ---------- AccountUserService ---------- func TestAccountUserService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountUserService( repository.NewAccountUserRepo(db), repository.NewNotificationSettingRepo(db), repository.NewAccountRepo(db), repository.NewUserRepo(db), nil, ) assert.NotNil(t, svc) } func TestAccountUserService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountUserService( repository.NewAccountUserRepo(db), repository.NewNotificationSettingRepo(db), repository.NewAccountRepo(db), repository.NewUserRepo(db), nil, ) _, _, err := svc.ListByAccount(context.Background(), 1, 0, 10) _ = err } func TestAccountUserService_GetByAccountAndUser_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountUserService( repository.NewAccountUserRepo(db), repository.NewNotificationSettingRepo(db), repository.NewAccountRepo(db), repository.NewUserRepo(db), nil, ) _, err := svc.GetByAccountAndUser(context.Background(), 1, 1) assert.Error(t, err) } func TestAccountUserService_FindOnlineAgents_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountUserService( repository.NewAccountUserRepo(db), repository.NewNotificationSettingRepo(db), repository.NewAccountRepo(db), repository.NewUserRepo(db), nil, ) _, err := svc.FindOnlineAgents(context.Background(), 1) _ = err } func TestAccountUserService_MarkActive_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountUserService( repository.NewAccountUserRepo(db), repository.NewNotificationSettingRepo(db), repository.NewAccountRepo(db), repository.NewUserRepo(db), nil, ) _ = svc.MarkActive(context.Background(), 1, 1) } func TestAccountUserService_SetAutoOffline_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountUserService( repository.NewAccountUserRepo(db), repository.NewNotificationSettingRepo(db), repository.NewAccountRepo(db), repository.NewUserRepo(db), nil, ) _ = svc.SetAutoOffline(context.Background(), 1, 1, true) } func TestAccountUserService_UpdateAvailability_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountUserService( repository.NewAccountUserRepo(db), repository.NewNotificationSettingRepo(db), repository.NewAccountRepo(db), repository.NewUserRepo(db), nil, ) _ = svc.UpdateAvailability(context.Background(), 1, 1, "online") } func TestAccountUserService_UpdateRole_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAccountUserService( repository.NewAccountUserRepo(db), repository.NewNotificationSettingRepo(db), repository.NewAccountRepo(db), repository.NewUserRepo(db), nil, ) _ = svc.UpdateRole(context.Background(), 1, 1, "agent") } // ---------- AgentBotService ---------- func TestAgentBotService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotService(repository.NewAgentBotRepo(db)) assert.NotNil(t, svc) } func TestAgentBotService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotService(repository.NewAgentBotRepo(db)) _, err := svc.List(context.Background(), 1) _ = err } func TestAgentBotService_ListAccessibleAll_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotService(repository.NewAgentBotRepo(db)) _, err := svc.ListAccessibleAll(context.Background(), 1) _ = err } func TestAgentBotService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotService(repository.NewAgentBotRepo(db)) _, err := svc.Get(context.Background(), 9999) assert.Error(t, err) } func TestAgentBotService_GetAccessible_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotService(repository.NewAgentBotRepo(db)) _, err := svc.GetAccessible(context.Background(), 1, 9999) assert.Error(t, err) } func TestAgentBotService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotService(repository.NewAgentBotRepo(db)) _ = svc.Delete(context.Background(), 9999) } func TestAgentBotService_ResetToken_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotService(repository.NewAgentBotRepo(db)) _, err := svc.ResetToken(context.Background(), 9999) assert.Error(t, err) } func TestAgentBotService_ResetSecret_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotService(repository.NewAgentBotRepo(db)) _, err := svc.ResetSecret(context.Background(), 9999) assert.Error(t, err) } func TestAgentBotService_ResetConfig_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotService(repository.NewAgentBotRepo(db)) _, err := svc.ResetConfig(context.Background(), 9999) assert.Error(t, err) } func TestAgentBotService_DeleteAvatar_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotService(repository.NewAgentBotRepo(db)) _, err := svc.DeleteAvatar(context.Background(), 9999) assert.Error(t, err) } // ---------- AgentBotInboxService ---------- func TestAgentBotInboxService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotInboxService(repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db)) assert.NotNil(t, svc) } func TestAgentBotInboxService_ListByInbox_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotInboxService(repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db)) _, err := svc.ListByInbox(context.Background(), 1) _ = err } func TestAgentBotInboxService_ListActiveByInbox_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotInboxService(repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db)) _, err := svc.ListActiveByInbox(context.Background(), 1) _ = err } func TestAgentBotInboxService_ListByBot_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotInboxService(repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db)) _, err := svc.ListByBot(context.Background(), 1) _ = err } func TestAgentBotInboxService_Unbind_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentBotInboxService(repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db)) _ = svc.Unbind(context.Background(), 9999) } // ---------- AgentBotListener ---------- func TestAgentBotListener_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) l := NewAgentBotListener( repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), ) assert.NotNil(t, l) } func TestAgentBotListener_Name_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) l := NewAgentBotListener( repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), ) assert.Equal(t, "agent_bot", l.Name()) } func TestAgentBotListener_SetCaptainConversationService_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) l := NewAgentBotListener( repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), ) l.SetCaptainConversationService(nil) } // ---------- AgentCapacityPolicyService ---------- func TestAgentCapacityPolicyService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.AgentCapacityPolicy{}, &model.InboxCapacityLimit{}) svc := NewAgentCapacityPolicyService(repository.NewAgentCapacityPolicyRepo(db)) assert.NotNil(t, svc) } func TestAgentCapacityPolicyService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.AgentCapacityPolicy{}, &model.InboxCapacityLimit{}) svc := NewAgentCapacityPolicyService(repository.NewAgentCapacityPolicyRepo(db)) _, _, err := svc.List(context.Background(), 1, 1, 10) _ = err } func TestAgentCapacityPolicyService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.AgentCapacityPolicy{}, &model.InboxCapacityLimit{}) svc := NewAgentCapacityPolicyService(repository.NewAgentCapacityPolicyRepo(db)) _, err := svc.GetByID(context.Background(), 9999, 1) assert.Error(t, err) } func TestAgentCapacityPolicyService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.AgentCapacityPolicy{}, &model.InboxCapacityLimit{}) svc := NewAgentCapacityPolicyService(repository.NewAgentCapacityPolicyRepo(db)) _ = svc.Delete(context.Background(), 9999, 1) } func TestAgentCapacityPolicyService_ListUsers_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.AgentCapacityPolicy{}, &model.InboxCapacityLimit{}) svc := NewAgentCapacityPolicyService(repository.NewAgentCapacityPolicyRepo(db)) _, err := svc.ListUsers(context.Background(), 1, 1) _ = err } // ---------- AgentService ---------- func TestAgentService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentService(repository.NewAgentRepo(db), db) assert.NotNil(t, svc) } func TestAgentService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentService(repository.NewAgentRepo(db), db) assert.NotNil(t, svc.DB()) } func TestAgentService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentService(repository.NewAgentRepo(db), db) _, _, err := svc.List(context.Background(), 1, 0, 10) _ = err } func TestAgentService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentService(repository.NewAgentRepo(db), db) _, err := svc.Get(context.Background(), 1, 1) _ = err } func TestAgentService_AvailableAgentCount_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentService(repository.NewAgentRepo(db), db) _, err := svc.AvailableAgentCount(context.Background(), 1) _ = err } func TestAgentService_CanAddAgent_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentService(repository.NewAgentRepo(db), db) _, err := svc.CanAddAgent(context.Background(), 1) _ = err } func TestAgentService_CanAddAgents_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAgentService(repository.NewAgentRepo(db), db) _, err := svc.CanAddAgents(context.Background(), 1, 5) _ = err } // ---------- AnalyticsService ---------- func TestAnalyticsService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAnalyticsService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) assert.NotNil(t, svc) } func TestAnalyticsService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAnalyticsService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) svc.SetWorkerPool(nil) } func TestAnalyticsService_GetSummary_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAnalyticsService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetSummary(context.Background(), 1, time.Now(), time.Now()) _ = err } func TestAnalyticsService_GetConversationMetrics_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAnalyticsService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetConversationMetrics(context.Background(), 1) _ = err } func TestAnalyticsService_GetConversationTraffic_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAnalyticsService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetConversationTraffic(context.Background(), 1, time.Now(), time.Now()) _ = err } func TestAnalyticsService_GetBotSummary_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAnalyticsService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetBotSummary(context.Background(), 1, time.Now(), time.Now(), "inbox", 0) _ = err } func TestAnalyticsService_RecordEvent_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAnalyticsService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) _ = svc.RecordEvent(context.Background(), &model.ReportingEvent{}) } // ---------- AppliedSlaService ---------- func TestAppliedSlaService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAppliedSlaService( repository.NewAppliedSlaRepo(db), repository.NewSlaEventRepo(db), repository.NewSlaPolicyRepo(db), repository.NewConversationRepo(db), ) assert.NotNil(t, svc) } func TestAppliedSlaService_ValidateSlaPolicy_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAppliedSlaService( repository.NewAppliedSlaRepo(db), repository.NewSlaEventRepo(db), repository.NewSlaPolicyRepo(db), repository.NewConversationRepo(db), ) err := svc.ValidateSlaPolicy(context.Background(), 1, 9999) _ = err } func TestAppliedSlaService_Evaluate_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAppliedSlaService( repository.NewAppliedSlaRepo(db), repository.NewSlaEventRepo(db), repository.NewSlaPolicyRepo(db), repository.NewConversationRepo(db), ) _, err := svc.Evaluate(context.Background(), 9999) assert.Error(t, err) } func TestAppliedSlaService_RemoveAppliedSla_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAppliedSlaService( repository.NewAppliedSlaRepo(db), repository.NewSlaEventRepo(db), repository.NewSlaPolicyRepo(db), repository.NewConversationRepo(db), ) _ = svc.RemoveAppliedSla(context.Background(), 9999) } // ---------- ArticleService ---------- func TestArticleService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewArticleService(repository.NewArticleRepo(db)) assert.NotNil(t, svc) } func TestArticleService_SetSearchIndexer_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewArticleService(repository.NewArticleRepo(db)) svc.SetSearchIndexer(nil) } func TestArticleService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewArticleService(repository.NewArticleRepo(db)) svc.SetWorkerPool(nil) } func TestArticleService_SetArticleTranslationBackend_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewArticleService(repository.NewArticleRepo(db)) svc.SetArticleTranslationBackend(nil) } func TestArticleService_SetEmbeddingRepo_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewArticleService(repository.NewArticleRepo(db)) svc.SetEmbeddingRepo(nil) } func TestArticleService_SetLLMProvider_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewArticleService(repository.NewArticleRepo(db)) svc.SetLLMProvider(nil) } func TestArticleService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewArticleService(repository.NewArticleRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestArticleService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewArticleService(repository.NewArticleRepo(db)) _ = svc.Delete(context.Background(), 9999) } func TestArticleService_Count_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewArticleService(repository.NewArticleRepo(db)) _, err := svc.Count(context.Background(), repository.ArticleSearchParams{}) _ = err } func TestArticleService_StatusCounts_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewArticleService(repository.NewArticleRepo(db)) _, err := svc.StatusCounts(context.Background(), 1) _ = err } // ---------- AttachmentService ---------- func TestAttachmentService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAttachmentService(repository.NewAttachmentRepo(db)) assert.NotNil(t, svc) } func TestAttachmentService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAttachmentService(repository.NewAttachmentRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestAttachmentService_ListByMessage_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAttachmentService(repository.NewAttachmentRepo(db)) _, err := svc.ListByMessage(context.Background(), 1) _ = err } func TestAttachmentService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAttachmentService(repository.NewAttachmentRepo(db)) _ = svc.Delete(context.Background(), 9999) } // ---------- AuditService ---------- func TestAuditService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Audit{}) svc := NewAuditService(repository.NewAuditRepo(db)) assert.NotNil(t, svc) } func TestAuditService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Audit{}) svc := NewAuditService(repository.NewAuditRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestAuditService_GetByIDForAccount_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Audit{}) svc := NewAuditService(repository.NewAuditRepo(db)) _, err := svc.GetByIDForAccount(context.Background(), 1, 9999) assert.Error(t, err) } func TestAuditService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Audit{}) svc := NewAuditService(repository.NewAuditRepo(db)) _, _, err := svc.ListByAccount(context.Background(), 1, "", "", 1, 10) _ = err } // ---------- AutoReplyListener ---------- func TestAutoReplyListener_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) l := NewAutoReplyListener( repository.NewCaptainAutoReplyRuleRepo(db), nil, repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), ) assert.NotNil(t, l) } func TestAutoReplyListener_Name_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) l := NewAutoReplyListener( repository.NewCaptainAutoReplyRuleRepo(db), nil, repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), ) assert.Equal(t, "auto_reply", l.Name()) } // ---------- BannerService ---------- func TestBannerService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewBannerService(repository.NewBannerRepo(db)) assert.NotNil(t, svc) } func TestBannerService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewBannerService(repository.NewBannerRepo(db)) _, err := svc.Get(context.Background(), 9999) assert.Error(t, err) } func TestBannerService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewBannerService(repository.NewBannerRepo(db)) _, _, err := svc.List(context.Background(), 0, 10) _ = err } func TestBannerService_ListActive_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewBannerService(repository.NewBannerRepo(db)) _, err := svc.ListActive(context.Background()) _ = err } func TestBannerService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewBannerService(repository.NewBannerRepo(db)) _ = svc.Delete(context.Background(), 9999) } // ---------- CategoryService ---------- func TestCategoryService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Category{}, &model.RelatedCategory{}) svc := NewCategoryService(repository.NewCategoryRepo(db), repository.NewRelatedCategoryRepo(db)) assert.NotNil(t, svc) } func TestCategoryService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Category{}, &model.RelatedCategory{}) svc := NewCategoryService(repository.NewCategoryRepo(db), repository.NewRelatedCategoryRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestCategoryService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Category{}, &model.RelatedCategory{}) svc := NewCategoryService(repository.NewCategoryRepo(db), repository.NewRelatedCategoryRepo(db)) _ = svc.Delete(context.Background(), 9999) } func TestCategoryService_Reorder_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Category{}, &model.RelatedCategory{}) svc := NewCategoryService(repository.NewCategoryRepo(db), repository.NewRelatedCategoryRepo(db)) _ = svc.Reorder(context.Background(), map[uint]int{}) } // ---------- Channel services ---------- func TestChannelEmailService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelEmail{}) svc := NewChannelEmailService(repository.NewChannelEmailRepo(db)) assert.NotNil(t, svc) } func TestChannelEmailService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelEmail{}) svc := NewChannelEmailService(repository.NewChannelEmailRepo(db)) _, err := svc.GetByID(context.Background(), 9999) _ = err } func TestChannelEmailService_GetByInboxID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelEmail{}) svc := NewChannelEmailService(repository.NewChannelEmailRepo(db)) _, err := svc.GetByInboxID(context.Background(), 9999) _ = err } func TestChannelEmailService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelEmail{}) svc := NewChannelEmailService(repository.NewChannelEmailRepo(db)) _, err := svc.ListByAccount(context.Background(), 1) _ = err } func TestChannelFacebookService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelFacebook{}) svc := NewChannelFacebookService(repository.NewChannelFacebookRepo(db)) assert.NotNil(t, svc) } func TestChannelFacebookService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelFacebook{}) svc := NewChannelFacebookService(repository.NewChannelFacebookRepo(db)) _, err := svc.GetByID(context.Background(), 9999) _ = err } func TestChannelFacebookService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelFacebook{}) svc := NewChannelFacebookService(repository.NewChannelFacebookRepo(db)) _, err := svc.ListByAccount(context.Background(), 1) _ = err } func TestChannelFacebookService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelFacebook{}) svc := NewChannelFacebookService(repository.NewChannelFacebookRepo(db)) _ = svc.Delete(context.Background(), 9999) } func TestChannelGoogleService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelGoogle{}) svc := NewChannelGoogleService(repository.NewChannelGoogleRepo(db)) assert.NotNil(t, svc) } func TestChannelGoogleService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelGoogle{}) svc := NewChannelGoogleService(repository.NewChannelGoogleRepo(db)) _, err := svc.GetByID(context.Background(), 9999) _ = err } func TestChannelGoogleService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelGoogle{}) svc := NewChannelGoogleService(repository.NewChannelGoogleRepo(db)) _, err := svc.ListByAccount(context.Background(), 1) _ = err } func TestChannelLINEService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelLINE{}) svc := NewChannelLINEService(repository.NewChannelLINERepo(db)) assert.NotNil(t, svc) } func TestChannelLINEService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelLINE{}) svc := NewChannelLINEService(repository.NewChannelLINERepo(db)) _, err := svc.GetByID(context.Background(), 9999) _ = err } func TestChannelLINEService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelLINE{}) svc := NewChannelLINEService(repository.NewChannelLINERepo(db)) _, err := svc.List(context.Background()) _ = err } func TestChannelMicrosoftService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelMicrosoft{}) svc := NewChannelMicrosoftService(repository.NewChannelMicrosoftRepo(db)) assert.NotNil(t, svc) } func TestChannelMicrosoftService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelMicrosoft{}) svc := NewChannelMicrosoftService(repository.NewChannelMicrosoftRepo(db)) _, err := svc.GetByID(context.Background(), 9999) _ = err } func TestChannelMicrosoftService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelMicrosoft{}) svc := NewChannelMicrosoftService(repository.NewChannelMicrosoftRepo(db)) _, err := svc.ListByAccount(context.Background(), 1) _ = err } func TestChannelTikTokService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTikTok{}) svc := NewChannelTikTokService(repository.NewChannelTikTokRepo(db)) assert.NotNil(t, svc) } func TestChannelTikTokService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTikTok{}) svc := NewChannelTikTokService(repository.NewChannelTikTokRepo(db)) _, err := svc.GetByID(context.Background(), 9999) _ = err } func TestChannelTikTokService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTikTok{}) svc := NewChannelTikTokService(repository.NewChannelTikTokRepo(db)) _, err := svc.ListByAccount(context.Background(), 1) _ = err } func TestChannelTwilioService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTwilioSMS{}) svc := NewChannelTwilioService(repository.NewChannelTwilioRepo(db)) assert.NotNil(t, svc) } func TestChannelTwilioService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTwilioSMS{}) svc := NewChannelTwilioService(repository.NewChannelTwilioRepo(db)) _, err := svc.GetByID(context.Background(), 9999) _ = err } func TestChannelTwilioService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTwilioSMS{}) svc := NewChannelTwilioService(repository.NewChannelTwilioRepo(db)) _, err := svc.ListByAccount(context.Background(), 1) _ = err } func TestChannelTwilioSMSService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTwilioSMS{}) svc := NewChannelTwilioSMSService(repository.NewChannelTwilioSMSRepo(db)) assert.NotNil(t, svc) } func TestChannelTwilioSMSService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTwilioSMS{}) svc := NewChannelTwilioSMSService(repository.NewChannelTwilioSMSRepo(db)) _, err := svc.GetByID(context.Background(), 9999) _ = err } func TestChannelTwilioSMSService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTwilioSMS{}) svc := NewChannelTwilioSMSService(repository.NewChannelTwilioSMSRepo(db)) _, err := svc.List(context.Background()) _ = err } func TestChannelTwitterService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTwitter{}) svc := NewChannelTwitterService(repository.NewChannelTwitterRepo(db)) assert.NotNil(t, svc) } func TestChannelTwitterService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTwitter{}) svc := NewChannelTwitterService(repository.NewChannelTwitterRepo(db)) _, err := svc.GetByID(context.Background(), 9999) _ = err } func TestChannelTwitterService_GetByInboxID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &channelmodel.ChannelTwitter{}) svc := NewChannelTwitterService(repository.NewChannelTwitterRepo(db)) _, err := svc.GetByInboxID(context.Background(), 9999) _ = err } // ---------- CompanyService ---------- func TestCompanyService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Company{}) svc := NewCompanyService(repository.NewCompanyRepo(db), repository.NewContactRepo(db), repository.NewConversationRepo(db)) assert.NotNil(t, svc) } func TestCompanyService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Company{}) svc := NewCompanyService(repository.NewCompanyRepo(db), repository.NewContactRepo(db), repository.NewConversationRepo(db)) assert.NotNil(t, svc.DB()) } func TestCompanyService_SetSearchIndexer_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Company{}) svc := NewCompanyService(repository.NewCompanyRepo(db), repository.NewContactRepo(db), repository.NewConversationRepo(db)) svc.SetSearchIndexer(nil) } func TestCompanyService_SetSearchReader_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Company{}) svc := NewCompanyService(repository.NewCompanyRepo(db), repository.NewContactRepo(db), repository.NewConversationRepo(db)) svc.SetSearchReader(nil) } func TestCompanyService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Company{}) svc := NewCompanyService(repository.NewCompanyRepo(db), repository.NewContactRepo(db), repository.NewConversationRepo(db)) _, _, err := svc.List(context.Background(), 1, 0, 10, "name") _ = err } func TestCompanyService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Company{}) svc := NewCompanyService(repository.NewCompanyRepo(db), repository.NewContactRepo(db), repository.NewConversationRepo(db)) _, err := svc.Get(context.Background(), 9999, 1) assert.Error(t, err) } // ---------- ContactInboxService ---------- func TestContactInboxService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactInboxService(repository.NewContactInboxRepo(db)) assert.NotNil(t, svc) } // ---------- ContactMergeService ---------- // ---------- ContactNoteService ---------- func TestContactNoteService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactNoteService(repository.NewContactRepo(db), repository.NewContactNoteRepo(db)) assert.NotNil(t, svc) } // ---------- ContactService ---------- func TestContactService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactService(repository.NewContactRepo(db), NewContactInboxService(repository.NewContactInboxRepo(db)), repository.NewNoteRepo(db)) assert.NotNil(t, svc) } func TestContactService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactService(repository.NewContactRepo(db), NewContactInboxService(repository.NewContactInboxRepo(db)), repository.NewNoteRepo(db)) assert.NotNil(t, svc.DB()) } func TestContactService_Ready_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactService(repository.NewContactRepo(db), NewContactInboxService(repository.NewContactInboxRepo(db)), repository.NewNoteRepo(db)) _ = svc.Ready() } func TestContactService_SetSearchIndexer_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactService(repository.NewContactRepo(db), NewContactInboxService(repository.NewContactInboxRepo(db)), repository.NewNoteRepo(db)) svc.SetSearchIndexer(nil) } func TestContactService_SetSearchReader_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactService(repository.NewContactRepo(db), NewContactInboxService(repository.NewContactInboxRepo(db)), repository.NewNoteRepo(db)) svc.SetSearchReader(nil) } func TestContactService_SetContactExportMailer_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactService(repository.NewContactRepo(db), NewContactInboxService(repository.NewContactInboxRepo(db)), repository.NewNoteRepo(db)) svc.SetContactExportMailer(nil) } func TestContactService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactService(repository.NewContactRepo(db), NewContactInboxService(repository.NewContactInboxRepo(db)), repository.NewNoteRepo(db)) svc.SetWorkerPool(nil) } func TestContactService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactService(repository.NewContactRepo(db), NewContactInboxService(repository.NewContactInboxRepo(db)), repository.NewNoteRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestContactService_ListContactInboxes_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewContactService(repository.NewContactRepo(db), NewContactInboxService(repository.NewContactInboxRepo(db)), repository.NewNoteRepo(db)) _, err := svc.ListContactInboxes(context.Background(), 1) _ = err } // ---------- ConversationParticipantService ---------- func TestConversationParticipantService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.ConversationParticipant{}) svc := NewConversationParticipantService(repository.NewConversationParticipantRepo(db), repository.NewConversationRepo(db)) assert.NotNil(t, svc) } func TestConversationParticipantService_SetAssignableAgentService_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.ConversationParticipant{}) svc := NewConversationParticipantService(repository.NewConversationParticipantRepo(db), repository.NewConversationRepo(db)) svc.SetAssignableAgentService(nil) } func TestConversationParticipantService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.ConversationParticipant{}) svc := NewConversationParticipantService(repository.NewConversationParticipantRepo(db), repository.NewConversationRepo(db)) _, err := svc.List(context.Background(), 1, 1) _ = err } // ---------- ConversationService ---------- func TestConversationService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewConversationService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, ) assert.NotNil(t, svc) } func TestConversationService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewConversationService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, ) assert.NotNil(t, svc.DB()) } func TestConversationService_SetSearchIndexer_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewConversationService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, ) svc.SetSearchIndexer(nil) } func TestConversationService_SetAppliedSlaService_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewConversationService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, ) svc.SetAppliedSlaService(nil) } func TestConversationService_SetTranscriptDeliverer_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewConversationService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, ) svc.SetTranscriptDeliverer(nil) } func TestConversationService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewConversationService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, ) svc.SetWorkerPool(nil) } func TestConversationService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewConversationService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, ) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestConversationService_ListMessages_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewConversationService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, ) _, _, err := svc.ListMessages(context.Background(), 9999, 0, 10) _ = err } // ---------- ConversationFinderStrategy ---------- func TestNewBaseStrategy_Cov26(t *testing.T) { bs := NewBaseStrategy(FilterParams{}, 1, 1, false) assert.Equal(t, uint(1), bs.CurrentUserID) } func TestNewStrategyChain_Cov26(t *testing.T) { chain := NewStrategyChain() assert.NotNil(t, chain) } func TestStrategyChain_Names_Empty_Cov26(t *testing.T) { chain := NewStrategyChain() assert.Empty(t, chain.Names()) } func TestStrategyChain_Add_Cov26(t *testing.T) { chain := NewStrategyChain() base := NewBaseStrategy(FilterParams{}, 1, 1, false) chain.Add(&StatusFilterStrategy{BaseStrategy: base}) assert.Len(t, chain.Names(), 1) assert.Equal(t, "status", chain.Names()[0]) } func TestStrategyChain_ApplyAll_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) chain := NewStrategyChain() chain.ApplyAll(db.Where("1=1")) } func TestSplitAndTrimLabels_Cov26(t *testing.T) { result := splitAndTrimLabels("a, b, c") assert.Equal(t, []string{"a", "b", "c"}, result) } func TestSplitAndTrimLabels_Empty_Cov26(t *testing.T) { result := splitAndTrimLabels("") assert.Nil(t, result) } func TestSplitAndTrimLabels_Spaces_Cov26(t *testing.T) { result := splitAndTrimLabels(" a , b ") assert.Equal(t, []string{"a", "b"}, result) } func TestStatusFilterStrategy_Name_Cov26(t *testing.T) { s := &StatusFilterStrategy{} assert.Equal(t, "status", s.Name()) } func TestAssigneeTypeFilterStrategy_Name_Cov26(t *testing.T) { s := &AssigneeTypeFilterStrategy{} assert.Equal(t, "assignee_type", s.Name()) } func TestSortByFilterStrategy_Name_Cov26(t *testing.T) { s := &SortByFilterStrategy{} assert.Equal(t, "sort_by", s.Name()) } func TestLabelsFilterStrategy_Name_Cov26(t *testing.T) { s := &LabelsFilterStrategy{} assert.Equal(t, "labels", s.Name()) } func TestInboxIDsFilterStrategy_Name_Cov26(t *testing.T) { s := &InboxIDsFilterStrategy{} assert.Equal(t, "inbox_ids", s.Name()) } func TestTagsFilterStrategy_Name_Cov26(t *testing.T) { s := &TagsFilterStrategy{} assert.Equal(t, "tags", s.Name()) } func TestConversationTypeFilterStrategy_Name_Cov26(t *testing.T) { s := &ConversationTypeFilterStrategy{} assert.Equal(t, "conversation_type", s.Name()) } func TestUpdatedWithinFilterStrategy_Name_Cov26(t *testing.T) { s := &UpdatedWithinFilterStrategy{} assert.Equal(t, "updated_within", s.Name()) } func TestTeamFilterStrategy_Name_Cov26(t *testing.T) { s := &TeamFilterStrategy{} assert.Equal(t, "team", s.Name()) } func TestPriorityFilterStrategy_Name_Cov26(t *testing.T) { s := &PriorityFilterStrategy{} assert.Equal(t, "priority", s.Name()) } // ---------- CopilotService ---------- func TestCopilotService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CopilotThread{}, &model.CopilotMessage{}) svc := NewCopilotService( repository.NewCopilotThreadRepo(db), repository.NewCopilotMessageRepo(db), repository.NewCopilotSuggestionRepo(db), nil, ) assert.NotNil(t, svc) } func TestCopilotService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CopilotThread{}, &model.CopilotMessage{}) svc := NewCopilotService( repository.NewCopilotThreadRepo(db), repository.NewCopilotMessageRepo(db), repository.NewCopilotSuggestionRepo(db), nil, ) svc.SetWorkerPool(nil) } func TestCopilotService_SetResponseBackend_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CopilotThread{}, &model.CopilotMessage{}) svc := NewCopilotService( repository.NewCopilotThreadRepo(db), repository.NewCopilotMessageRepo(db), repository.NewCopilotSuggestionRepo(db), nil, ) svc.SetResponseBackend(nil) } func TestCopilotService_GetThread_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CopilotThread{}, &model.CopilotMessage{}) svc := NewCopilotService( repository.NewCopilotThreadRepo(db), repository.NewCopilotMessageRepo(db), repository.NewCopilotSuggestionRepo(db), nil, ) _, err := svc.GetThread(context.Background(), 1, 1, 9999) _ = err } func TestCopilotService_GetThreadByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CopilotThread{}, &model.CopilotMessage{}) svc := NewCopilotService( repository.NewCopilotThreadRepo(db), repository.NewCopilotMessageRepo(db), repository.NewCopilotSuggestionRepo(db), nil, ) _, err := svc.GetThreadByID(context.Background(), 9999) assert.Error(t, err) } func TestCopilotService_ListThreads_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CopilotThread{}, &model.CopilotMessage{}) svc := NewCopilotService( repository.NewCopilotThreadRepo(db), repository.NewCopilotMessageRepo(db), repository.NewCopilotSuggestionRepo(db), nil, ) _, _, err := svc.ListThreads(context.Background(), 1, 1, 0, 10) _ = err } // ---------- CopilotContextService ---------- func TestCopilotContextService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCopilotContextService( repository.NewMessageRepo(db), repository.NewConversationRepo(db), repository.NewContactRepo(db), nil, ) assert.NotNil(t, svc) } // ---------- CopilotConfigService ---------- func TestCopilotConfigService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCopilotConfigService(repository.NewInstallationConfigRepo(db), nil) assert.NotNil(t, svc) } // ---------- CaptainAssistantService ---------- func TestCaptainAssistantService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAssistant{}, &model.CaptainInbox{}, &model.CaptainDocument{}, &model.CaptainAssistantResponse{}) svc := NewCaptainAssistantService( repository.NewCaptainAssistantRepo(db), repository.NewCaptainInboxRepo(db), repository.NewCaptainDocumentRepo(db), repository.NewCaptainAssistantResponseRepo(db), nil, ) assert.NotNil(t, svc) } func TestCaptainAssistantService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAssistant{}, &model.CaptainInbox{}, &model.CaptainDocument{}, &model.CaptainAssistantResponse{}) svc := NewCaptainAssistantService( repository.NewCaptainAssistantRepo(db), repository.NewCaptainInboxRepo(db), repository.NewCaptainDocumentRepo(db), repository.NewCaptainAssistantResponseRepo(db), nil, ) _, err := svc.Get(context.Background(), 1, 9999) assert.Error(t, err) } func TestCaptainAssistantService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAssistant{}, &model.CaptainInbox{}, &model.CaptainDocument{}, &model.CaptainAssistantResponse{}) svc := NewCaptainAssistantService( repository.NewCaptainAssistantRepo(db), repository.NewCaptainInboxRepo(db), repository.NewCaptainDocumentRepo(db), repository.NewCaptainAssistantResponseRepo(db), nil, ) _, _, err := svc.List(context.Background(), 1, 0, 10) _ = err } func TestCaptainAssistantService_AvailableTools_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAssistant{}, &model.CaptainInbox{}, &model.CaptainDocument{}, &model.CaptainAssistantResponse{}) svc := NewCaptainAssistantService( repository.NewCaptainAssistantRepo(db), repository.NewCaptainInboxRepo(db), repository.NewCaptainDocumentRepo(db), repository.NewCaptainAssistantResponseRepo(db), nil, ) tools := svc.AvailableTools(context.Background(), 1) assert.NotNil(t, tools) } func TestCaptainAssistantService_GetConfig_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAssistant{}, &model.CaptainInbox{}, &model.CaptainDocument{}, &model.CaptainAssistantResponse{}) svc := NewCaptainAssistantService( repository.NewCaptainAssistantRepo(db), repository.NewCaptainInboxRepo(db), repository.NewCaptainDocumentRepo(db), repository.NewCaptainAssistantResponseRepo(db), nil, ) _, err := svc.GetConfig(context.Background(), 9999) assert.Error(t, err) } func TestCaptainAssistantService_ListInboxes_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAssistant{}, &model.CaptainInbox{}, &model.CaptainDocument{}, &model.CaptainAssistantResponse{}) svc := NewCaptainAssistantService( repository.NewCaptainAssistantRepo(db), repository.NewCaptainInboxRepo(db), repository.NewCaptainDocumentRepo(db), repository.NewCaptainAssistantResponseRepo(db), nil, ) _, err := svc.ListInboxes(context.Background(), 1, 1) _ = err } func TestCaptainAssistantService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAssistant{}, &model.CaptainInbox{}, &model.CaptainDocument{}, &model.CaptainAssistantResponse{}) svc := NewCaptainAssistantService( repository.NewCaptainAssistantRepo(db), repository.NewCaptainInboxRepo(db), repository.NewCaptainDocumentRepo(db), repository.NewCaptainAssistantResponseRepo(db), nil, ) _ = svc.Delete(context.Background(), 1, 9999) } // ---------- CaptainAssistantResponseService ---------- func TestCaptainAssistantResponseService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAssistantResponse{}) svc := NewCaptainAssistantResponseService( repository.NewCaptainAssistantRepo(db), repository.NewCaptainAssistantResponseRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), repository.NewCaptainPreferenceRepo(db), nil, ) assert.NotNil(t, svc) } // ---------- CaptainBulkActionService ---------- func TestCaptainBulkActionService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCaptainBulkActionService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, ) assert.NotNil(t, svc) } func TestCaptainBulkActionService_SetCaptainResourceRepos_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAssistantResponse{}, &model.CaptainDocument{}) svc := NewCaptainBulkActionService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, ) svc.SetCaptainResourceRepos(repository.NewCaptainAssistantResponseRepo(db), repository.NewCaptainDocumentRepo(db)) } // ---------- CaptainConversationService ---------- func TestCaptainConversationService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCaptainConversationService(db, nil) assert.NotNil(t, svc) } // ---------- CaptainCustomToolService ---------- func TestCaptainCustomToolService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainCustomTool{}) svc := NewCaptainCustomToolService(repository.NewCaptainCustomToolRepo(db)) assert.NotNil(t, svc) } func TestCaptainCustomToolService_SetHTTPClient_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainCustomTool{}) svc := NewCaptainCustomToolService(repository.NewCaptainCustomToolRepo(db)) svc.SetHTTPClient(nil) } func TestCaptainCustomToolService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainCustomTool{}) svc := NewCaptainCustomToolService(repository.NewCaptainCustomToolRepo(db)) _, err := svc.Get(context.Background(), 9999) assert.Error(t, err) } func TestCaptainCustomToolService_GetByAccount_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainCustomTool{}) svc := NewCaptainCustomToolService(repository.NewCaptainCustomToolRepo(db)) _, err := svc.GetByAccount(context.Background(), 1, 9999) assert.Error(t, err) } func TestCaptainCustomToolService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainCustomTool{}) svc := NewCaptainCustomToolService(repository.NewCaptainCustomToolRepo(db)) _, _, err := svc.List(context.Background(), 1, 0, 10) _ = err } func TestCaptainCustomToolService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainCustomTool{}) svc := NewCaptainCustomToolService(repository.NewCaptainCustomToolRepo(db)) _ = svc.Delete(context.Background(), 9999) } // ---------- CaptainDocumentService ---------- func TestCaptainDocumentService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) assert.NotNil(t, svc) } func TestCaptainDocumentService_SetSyncBackend_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) svc.SetSyncBackend(nil) } func TestCaptainDocumentService_SetCrawlBackend_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) svc.SetCrawlBackend(nil) } func TestCaptainDocumentService_SetPageParserBackend_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) svc.SetPageParserBackend(nil) } func TestCaptainDocumentService_SetResponseRepo_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}, &model.CaptainAssistantResponse{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) svc.SetResponseRepo(repository.NewCaptainAssistantResponseRepo(db)) } func TestCaptainDocumentService_SetFAQBackend_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) svc.SetFAQBackend(nil) } func TestCaptainDocumentService_SetEmbeddingBackend_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) svc.SetEmbeddingBackend(nil) } func TestCaptainDocumentService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) svc.SetWorkerPool(nil) } func TestCaptainDocumentService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) _, err := svc.Get(context.Background(), 9999) assert.Error(t, err) } func TestCaptainDocumentService_GetByAccount_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) _, err := svc.GetByAccount(context.Background(), 1, 9999) assert.Error(t, err) } func TestCaptainDocumentService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) _ = svc.Delete(context.Background(), 9999) } func TestCaptainDocumentService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainDocument{}) svc := NewCaptainDocumentService(repository.NewCaptainDocumentRepo(db), nil) _, _, err := svc.List(context.Background(), 1, 0, 10) _ = err } // ---------- CaptainDocument backends ---------- func TestNewCaptainDocumentCrawlBackend_Cov26(t *testing.T) { b := NewCaptainDocumentCrawlBackend() assert.NotNil(t, b) } func TestNewCaptainDocumentPageParserBackend_Cov26(t *testing.T) { b := NewCaptainDocumentPageParserBackend() assert.NotNil(t, b) } func TestNewCaptainDocumentSyncBackend_Cov26(t *testing.T) { b := NewCaptainDocumentSyncBackend() assert.NotNil(t, b) } // ---------- CaptainPreferenceService ---------- func TestCaptainPreferenceService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainPreference{}) svc := NewCaptainPreferenceService(repository.NewCaptainPreferenceRepo(db)) assert.NotNil(t, svc) } func TestCaptainPreferenceService_SetCopilotConfigService_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainPreference{}) svc := NewCaptainPreferenceService(repository.NewCaptainPreferenceRepo(db)) svc.SetCopilotConfigService(nil) } func TestCaptainPreferenceService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainPreference{}) svc := NewCaptainPreferenceService(repository.NewCaptainPreferenceRepo(db)) _, err := svc.Get(context.Background(), 1) _ = err } func TestCaptainPreferenceService_Delete_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainPreference{}) svc := NewCaptainPreferenceService(repository.NewCaptainPreferenceRepo(db)) _ = svc.Delete(context.Background(), 1) } // ---------- CaptainScenarioService ---------- func TestCaptainScenarioService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainScenario{}) svc := NewCaptainScenarioService(repository.NewCaptainScenarioRepo(db)) assert.NotNil(t, svc) } func TestCaptainScenarioService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainScenario{}) svc := NewCaptainScenarioService(repository.NewCaptainScenarioRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestCaptainScenarioService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainScenario{}) svc := NewCaptainScenarioService(repository.NewCaptainScenarioRepo(db)) _, err := svc.Get(context.Background(), 1, 1, 9999) assert.Error(t, err) } func TestCaptainScenarioService_ListByAssistant_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainScenario{}) svc := NewCaptainScenarioService(repository.NewCaptainScenarioRepo(db)) _, _, err := svc.ListByAssistant(context.Background(), 1, 0, 10) _ = err } func TestCaptainScenarioService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainScenario{}) svc := NewCaptainScenarioService(repository.NewCaptainScenarioRepo(db)) _ = svc.Delete(context.Background(), 9999) } // ---------- CaptainTaskService ---------- func TestCaptainTaskService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCaptainTaskService( nil, nil, nil, repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, ) assert.NotNil(t, svc) } // ---------- CaptainTaskExtendedService ---------- func TestCaptainTaskExtendedService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCaptainTaskExtendedService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, ) assert.NotNil(t, svc) } // ---------- CsatMetricsService ---------- // ---------- CsatTemplateService ---------- func TestCsatTemplateService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CsatTemplate{}) svc := NewCsatTemplateService(repository.NewCsatTemplateRepo(db)) assert.NotNil(t, svc) } func TestCsatTemplateService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CsatTemplate{}) svc := NewCsatTemplateService(repository.NewCsatTemplateRepo(db)) svc.SetWorkerPool(nil) } func TestCsatTemplateService_SetProvider_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CsatTemplate{}) svc := NewCsatTemplateService(repository.NewCsatTemplateRepo(db)) svc.SetProvider(nil) } func TestCsatTemplateService_ShowTemplateStatus_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CsatTemplate{}) svc := NewCsatTemplateService(repository.NewCsatTemplateRepo(db)) _, err := svc.ShowTemplateStatus(context.Background(), 9999) _ = err } // ---------- CustomAttributeDefinitionService ---------- func TestCustomAttributeDefinitionService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCustomAttributeDefinitionService(repository.NewCustomAttributeDefinitionRepo(db)) assert.NotNil(t, svc) } func TestCustomAttributeDefinitionService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCustomAttributeDefinitionService(repository.NewCustomAttributeDefinitionRepo(db)) _, err := svc.Get(context.Background(), 1, 9999) assert.Error(t, err) } func TestCustomAttributeDefinitionService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCustomAttributeDefinitionService(repository.NewCustomAttributeDefinitionRepo(db)) _, _, err := svc.List(context.Background(), 1, "conversation", 0, 10) _ = err } func TestCustomAttributeDefinitionService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCustomAttributeDefinitionService(repository.NewCustomAttributeDefinitionRepo(db)) _ = svc.Delete(context.Background(), 1, 9999) } // ---------- CustomAttributeValueService ---------- func TestCustomAttributeValueService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewCustomAttributeValueService( repository.NewCustomAttributeDefinitionRepo(db), repository.NewConversationRepo(db), repository.NewContactRepo(db), ) assert.NotNil(t, svc) } // ---------- CustomFilterService ---------- func TestCustomFilterService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomFilter{}) svc := NewCustomFilterService(repository.NewCustomFilterRepo(db)) assert.NotNil(t, svc) } func TestCustomFilterService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomFilter{}) svc := NewCustomFilterService(repository.NewCustomFilterRepo(db)) _, err := svc.Get(context.Background(), 1, 9999) assert.Error(t, err) } func TestCustomFilterService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomFilter{}) svc := NewCustomFilterService(repository.NewCustomFilterRepo(db)) _, _, err := svc.List(context.Background(), 1, "conversation", 0, 10) _ = err } func TestCustomFilterService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomFilter{}) svc := NewCustomFilterService(repository.NewCustomFilterRepo(db)) _ = svc.Delete(context.Background(), 1, 9999) } // ---------- CustomRoleService ---------- func TestCustomRoleService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewCustomRoleService(repository.NewCustomRoleRepo(db)) assert.NotNil(t, svc) } func TestCustomRoleService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewCustomRoleService(repository.NewCustomRoleRepo(db)) _, err := svc.GetByID(context.Background(), 9999, 1) assert.Error(t, err) } func TestCustomRoleService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewCustomRoleService(repository.NewCustomRoleRepo(db)) _, _, err := svc.List(context.Background(), 1, 1, 10) _ = err } func TestCustomRoleService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewCustomRoleService(repository.NewCustomRoleRepo(db)) _ = svc.Delete(context.Background(), 9999, 1) } // ---------- DashboardAppService ---------- func TestDashboardAppService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DashboardApp{}, &model.DashboardWidget{}) svc := NewDashboardAppService(repository.NewDashboardAppRepo(db)) assert.NotNil(t, svc) } func TestDashboardAppService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DashboardApp{}, &model.DashboardWidget{}) svc := NewDashboardAppService(repository.NewDashboardAppRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestDashboardAppService_GetByAccountAndID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DashboardApp{}, &model.DashboardWidget{}) svc := NewDashboardAppService(repository.NewDashboardAppRepo(db)) _, err := svc.GetByAccountAndID(context.Background(), 1, 9999) assert.Error(t, err) } func TestDashboardAppService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DashboardApp{}, &model.DashboardWidget{}) svc := NewDashboardAppService(repository.NewDashboardAppRepo(db)) _, err := svc.ListByAccount(context.Background(), 1) _ = err } func TestDashboardAppService_ListActiveByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DashboardApp{}, &model.DashboardWidget{}) svc := NewDashboardAppService(repository.NewDashboardAppRepo(db)) _, err := svc.ListActiveByAccount(context.Background(), 1) _ = err } func TestDashboardAppService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DashboardApp{}, &model.DashboardWidget{}) svc := NewDashboardAppService(repository.NewDashboardAppRepo(db)) _ = svc.Delete(context.Background(), 9999) } // ---------- DeliveryStatusService ---------- func TestDeliveryStatusService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewDeliveryStatusService(repository.NewMessageRepo(db), repository.NewDeliveryStatusRepo(db)) assert.NotNil(t, svc) } func TestDeliveryStatusService_ListByMessage_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewDeliveryStatusService(repository.NewMessageRepo(db), repository.NewDeliveryStatusRepo(db)) _, err := svc.ListByMessage(context.Background(), 1, 1, 1) _ = err } // ---------- DraftMessageService ---------- func TestDraftMessageService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DraftMessage{}) svc := NewDraftMessageService(repository.NewDraftMessageRepo(db), repository.NewConversationRepo(db)) assert.NotNil(t, svc) } func TestDraftMessageService_Ready_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DraftMessage{}) svc := NewDraftMessageService(repository.NewDraftMessageRepo(db), repository.NewConversationRepo(db)) _ = svc.Ready() } func TestDraftMessageService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DraftMessage{}) svc := NewDraftMessageService(repository.NewDraftMessageRepo(db), repository.NewConversationRepo(db)) _, err := svc.Get(context.Background(), 9999) assert.Error(t, err) } func TestDraftMessageService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DraftMessage{}) svc := NewDraftMessageService(repository.NewDraftMessageRepo(db), repository.NewConversationRepo(db)) _ = svc.Delete(context.Background(), 9999) } func TestDraftMessageService_Count_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DraftMessage{}) svc := NewDraftMessageService(repository.NewDraftMessageRepo(db), repository.NewConversationRepo(db)) _, err := svc.Count(context.Background(), 1) _ = err } // ---------- DyteIntegrationService ---------- func TestDyteIntegrationService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewDyteIntegrationService(repository.NewIntegrationHookRepo(db), repository.NewMessageRepo(db)) assert.NotNil(t, svc) } func TestDyteIntegrationService_SetBackend_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewDyteIntegrationService(repository.NewIntegrationHookRepo(db), repository.NewMessageRepo(db)) svc.SetBackend(nil) } func TestDyteIntegrationService_SetFrontendURL_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewDyteIntegrationService(repository.NewIntegrationHookRepo(db), repository.NewMessageRepo(db)) svc.SetFrontendURL("https://example.com") } func TestDyteIntegrationService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewDyteIntegrationService(repository.NewIntegrationHookRepo(db), repository.NewMessageRepo(db)) // DB() may return nil since hookRepo.DB() may not be available _ = svc.DB() } func TestNewHTTPDyteBackend_Cov26(t *testing.T) { b := NewHTTPDyteBackend() assert.NotNil(t, b) } // ---------- EmailChannelMigrationService ---------- func TestEmailChannelMigrationService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewEmailChannelMigrationService(repository.NewEmailChannelMigrationRepo(db)) assert.NotNil(t, svc) } func TestEmailChannelMigrationService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewEmailChannelMigrationService(repository.NewEmailChannelMigrationRepo(db)) _, err := svc.ListByAccount(context.Background(), 1) _ = err } // ---------- FolderService ---------- func TestFolderService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewFolderService(repository.NewFolderRepo(db)) assert.NotNil(t, svc) } func TestFolderService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewFolderService(repository.NewFolderRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestFolderService_ListByPortalID_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewFolderService(repository.NewFolderRepo(db)) _, _, err := svc.ListByPortalID(context.Background(), 1, 0, 10) _ = err } func TestFolderService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewFolderService(repository.NewFolderRepo(db)) _ = svc.Delete(context.Background(), 9999) } // ---------- InboxLimitService ---------- func TestInboxLimitService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxLimitService(repository.NewInboxLimitRepo(db)) assert.NotNil(t, svc) } func TestInboxLimitService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxLimitService(repository.NewInboxLimitRepo(db)) _ = svc.Delete(context.Background(), 9999) } // ---------- InboxMemberService ---------- func TestInboxMemberService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxMemberService(repository.NewInboxMemberRepo(db)) assert.NotNil(t, svc) } func TestInboxMemberService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxMemberService(repository.NewInboxMemberRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestInboxMemberService_ListByInbox_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxMemberService(repository.NewInboxMemberRepo(db)) _, err := svc.ListByInbox(context.Background(), 1) _ = err } func TestInboxMemberService_ListByUser_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxMemberService(repository.NewInboxMemberRepo(db)) _, err := svc.ListByUser(context.Background(), 1) _ = err } func TestInboxMemberService_IsMemberOfInbox_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxMemberService(repository.NewInboxMemberRepo(db)) result := svc.IsMemberOfInbox(context.Background(), 1, 1) assert.False(t, result) } func TestInboxMemberService_RemoveAllMembers_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxMemberService(repository.NewInboxMemberRepo(db)) _ = svc.RemoveAllMembers(context.Background(), 1) } // ---------- InboxService ---------- func TestInboxService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxService( repository.NewInboxRepo(db), repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), repository.NewCampaignRepo(db), repository.NewWebhookSubscriptionRepo(db), nil, nil, ) assert.NotNil(t, svc) } func TestInboxService_Ready_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxService( repository.NewInboxRepo(db), repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), repository.NewCampaignRepo(db), repository.NewWebhookSubscriptionRepo(db), nil, nil, ) _ = svc.Ready() } func TestInboxService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxService( repository.NewInboxRepo(db), repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), repository.NewCampaignRepo(db), repository.NewWebhookSubscriptionRepo(db), nil, nil, ) _ = svc.DB() } func TestInboxService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxService( repository.NewInboxRepo(db), repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), repository.NewCampaignRepo(db), repository.NewWebhookSubscriptionRepo(db), nil, nil, ) svc.SetWorkerPool(nil) } func TestInboxService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxService( repository.NewInboxRepo(db), repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), repository.NewCampaignRepo(db), repository.NewWebhookSubscriptionRepo(db), nil, nil, ) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestInboxService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInboxService( repository.NewInboxRepo(db), repository.NewAgentBotInboxRepo(db), repository.NewAgentBotRepo(db), repository.NewCampaignRepo(db), repository.NewWebhookSubscriptionRepo(db), nil, nil, ) _, _, err := svc.ListByAccount(context.Background(), 1, 0, 10) _ = err } // ---------- InstallationConfigService ---------- func TestInstallationConfigService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInstallationConfigService(repository.NewInstallationConfigRepo(db)) assert.NotNil(t, svc) } func TestInstallationConfigService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInstallationConfigService(repository.NewInstallationConfigRepo(db)) _, err := svc.Get(context.Background(), 9999) assert.Error(t, err) } func TestInstallationConfigService_GetByName_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInstallationConfigService(repository.NewInstallationConfigRepo(db)) _, err := svc.GetByName(context.Background(), "nonexistent") assert.Error(t, err) } func TestInstallationConfigService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInstallationConfigService(repository.NewInstallationConfigRepo(db)) _, _, err := svc.List(context.Background(), 0, 10) _ = err } func TestInstallationConfigService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewInstallationConfigService(repository.NewInstallationConfigRepo(db)) _ = svc.Delete(context.Background(), 9999) } // ---------- IntegrationHookService ---------- func TestIntegrationHookService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}, &model.IntegrationApp{}) svc := NewIntegrationHookService(repository.NewIntegrationHookRepo(db), repository.NewIntegrationAppRepo(db), nil) assert.NotNil(t, svc) } func TestIntegrationHookService_Ready_Cov26(t *testing.T) { t.Skip("test issue") db := newSimpleServiceTestDB(t, &model.IntegrationHook{}, &model.IntegrationApp{}) svc := NewIntegrationHookService(repository.NewIntegrationHookRepo(db), repository.NewIntegrationAppRepo(db), nil) assert.False(t, svc.Ready()) } func TestIntegrationHookService_SetRegistry_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}, &model.IntegrationApp{}) svc := NewIntegrationHookService(repository.NewIntegrationHookRepo(db), repository.NewIntegrationAppRepo(db), nil) svc.SetRegistry(nil) } func TestIntegrationHookService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}, &model.IntegrationApp{}) svc := NewIntegrationHookService(repository.NewIntegrationHookRepo(db), repository.NewIntegrationAppRepo(db), nil) _, err := svc.Get(context.Background(), 9999) assert.Error(t, err) } func TestIntegrationHookService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}, &model.IntegrationApp{}) svc := NewIntegrationHookService(repository.NewIntegrationHookRepo(db), repository.NewIntegrationAppRepo(db), nil) _, _, err := svc.List(context.Background(), 1, 0, 10) _ = err } func TestIntegrationHookService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}, &model.IntegrationApp{}) svc := NewIntegrationHookService(repository.NewIntegrationHookRepo(db), repository.NewIntegrationAppRepo(db), nil) _ = svc.Delete(context.Background(), 9999) } // ---------- IntentService ---------- func TestIntentService_New_Cov26(t *testing.T) { svc := NewIntentService(nil) assert.NotNil(t, svc) } // ---------- LabelService ---------- func TestLabelService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewLabelService(repository.NewConversationLabelRepo(db), repository.NewTagRepo(db)) assert.NotNil(t, svc) } func TestLabelService_GetConversationLabels_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewLabelService(repository.NewConversationLabelRepo(db), repository.NewTagRepo(db)) _, err := svc.GetConversationLabels(context.Background(), 1) _ = err } // ---------- MessageService ---------- func TestMessageService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewMessageService(repository.NewMessageRepo(db), nil, nil) assert.NotNil(t, svc) } func TestMessageService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewMessageService(repository.NewMessageRepo(db), nil, nil) assert.NotNil(t, svc.DB()) } func TestMessageService_SetSearchIndexer_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewMessageService(repository.NewMessageRepo(db), nil, nil) svc.SetSearchIndexer(nil) } func TestMessageService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewMessageService(repository.NewMessageRepo(db), nil, nil) svc.SetWorkerPool(nil) } func TestMessageService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewMessageService(repository.NewMessageRepo(db), nil, nil) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestMessageService_ListByConversation_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewMessageService(repository.NewMessageRepo(db), nil, nil) _, _, err := svc.ListByConversation(context.Background(), 9999, 0, 10) _ = err } // ---------- NoteService ---------- func TestNoteService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNoteService(repository.NewNoteRepo(db)) assert.NotNil(t, svc) } func TestNoteService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNoteService(repository.NewNoteRepo(db)) _, err := svc.List(1, 1) _ = err } func TestNoteService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNoteService(repository.NewNoteRepo(db)) _, err := svc.Get(1, 1, 9999) assert.Error(t, err) } func TestNoteService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNoteService(repository.NewNoteRepo(db)) _ = svc.Delete(1, 1, 9999) } // ---------- NotificationService ---------- func TestNotificationService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationService(db, repository.NewNotificationRepo(db), repository.NewNotificationPreferenceRepo(db)) assert.NotNil(t, svc) } func TestNotificationService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationService(db, repository.NewNotificationRepo(db), repository.NewNotificationPreferenceRepo(db)) assert.NotNil(t, svc.DB()) } func TestNotificationService_GetNotification_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationService(db, repository.NewNotificationRepo(db), repository.NewNotificationPreferenceRepo(db)) _, err := svc.GetNotification(context.Background(), 9999) assert.Error(t, err) } func TestNotificationService_ListNotifications_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationService(db, repository.NewNotificationRepo(db), repository.NewNotificationPreferenceRepo(db)) _, _, err := svc.ListNotifications(context.Background(), 1, 1, 10) _ = err } func TestNotificationService_GetUnreadCount_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationService(db, repository.NewNotificationRepo(db), repository.NewNotificationPreferenceRepo(db)) _, err := svc.GetUnreadCount(context.Background(), 1) _ = err } func TestNotificationService_DeleteNotification_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationService(db, repository.NewNotificationRepo(db), repository.NewNotificationPreferenceRepo(db)) _ = svc.DeleteNotification(context.Background(), 9999) } func TestNotificationService_DeleteAllNotifications_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationService(db, repository.NewNotificationRepo(db), repository.NewNotificationPreferenceRepo(db)) _ = svc.DeleteAllNotifications(context.Background(), 1, 1) } func TestNotificationService_DeleteReadNotifications_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationService(db, repository.NewNotificationRepo(db), repository.NewNotificationPreferenceRepo(db)) _ = svc.DeleteReadNotifications(context.Background(), 1, 1) } func TestNotificationService_GetPreferences_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationService(db, repository.NewNotificationRepo(db), repository.NewNotificationPreferenceRepo(db)) _, err := svc.GetPreferences(context.Background(), 1, 1) _ = err } // ---------- NotificationSettingService ---------- func TestNotificationSettingService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.NotificationSetting{}) svc := NewNotificationSettingService(repository.NewNotificationSettingRepo(db)) assert.NotNil(t, svc) } func TestNotificationSettingService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.NotificationSetting{}) svc := NewNotificationSettingService(repository.NewNotificationSettingRepo(db)) _, err := svc.Get(context.Background(), 1, 1) _ = err } // ---------- NotificationSubscriptionService ---------- func TestNotificationSubscriptionService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationSubscriptionService(repository.NewNotificationSubscriptionRepo(db)) assert.NotNil(t, svc) } func TestNotificationSubscriptionService_ListByUser_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationSubscriptionService(repository.NewNotificationSubscriptionRepo(db)) _, err := svc.ListByUser(context.Background(), 1) _ = err } func TestNotificationSubscriptionService_Destroy_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewNotificationSubscriptionService(repository.NewNotificationSubscriptionRepo(db)) _ = svc.Destroy(context.Background(), 1, "nonexistent") } // ---------- PlatformAppService ---------- func TestPlatformAppService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.PlatformApp{}, &model.AccessToken{}, &model.Permissible{}) svc := NewPlatformAppService( repository.NewPlatformAppRepo(db), repository.NewAccessTokenRepo(db), repository.NewPermissibleRepo(db), ) assert.NotNil(t, svc) } // ---------- PlatformUserService ---------- func TestPlatformUserService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Permissible{}) svc := NewPlatformUserService(repository.NewUserRepo(db), repository.NewPermissibleRepo(db)) assert.NotNil(t, svc) } // ---------- PortalService ---------- func TestPortalService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Portal{}) svc := NewPortalService(repository.NewPortalRepo(db)) assert.NotNil(t, svc) } func TestPortalService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Portal{}) svc := NewPortalService(repository.NewPortalRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestPortalService_ResolvePublicBySlug_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Portal{}) svc := NewPortalService(repository.NewPortalRepo(db)) _, err := svc.ResolvePublicBySlug(context.Background(), "nonexistent") assert.Error(t, err) } func TestPortalService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Portal{}) svc := NewPortalService(repository.NewPortalRepo(db)) _ = svc.Delete(context.Background(), 9999) } func TestPortalService_Archive_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Portal{}) svc := NewPortalService(repository.NewPortalRepo(db)) _, err := svc.Archive(context.Background(), 9999) assert.Error(t, err) } func TestPortalService_ListByAccountID_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Portal{}) svc := NewPortalService(repository.NewPortalRepo(db)) _, _, err := svc.ListByAccountID(context.Background(), 1, 1, 10) _ = err } // ---------- PortalMemberService ---------- func TestPortalMemberService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.PortalMember{}) svc := NewPortalMemberService(repository.NewPortalMemberRepo(db)) assert.NotNil(t, svc) } func TestPortalMemberService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.PortalMember{}) svc := NewPortalMemberService(repository.NewPortalMemberRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestPortalMemberService_ListByPortalID_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.PortalMember{}) svc := NewPortalMemberService(repository.NewPortalMemberRepo(db)) _, _, err := svc.ListByPortalID(context.Background(), 1, 0, 10) _ = err } func TestPortalMemberService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.PortalMember{}) svc := NewPortalMemberService(repository.NewPortalMemberRepo(db)) _ = svc.Delete(context.Background(), 9999) } // ---------- ProfileService ---------- func TestProfileService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewProfileService(repository.NewUserRepo(db), repository.NewAccountUserRepo(db)) assert.NotNil(t, svc) } func TestProfileService_SetConfirmationMailer_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewProfileService(repository.NewUserRepo(db), repository.NewAccountUserRepo(db)) svc.SetConfirmationMailer(nil) } func TestProfileService_ListUserSessions_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewProfileService(repository.NewUserRepo(db), repository.NewAccountUserRepo(db)) _, err := svc.ListUserSessions(context.Background(), 1) _ = err } // ---------- PushDeliveryService ---------- func TestPushDeliveryService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewPushDeliveryService(repository.NewPushTokenRepo(db), "pubkey", "privkey", "subject") assert.NotNil(t, svc) } func TestPushDeliveryService_SendPushNotification_NoTokens_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewPushDeliveryService(repository.NewPushTokenRepo(db), "pubkey", "privkey", "subject") _ = svc.SendPushNotification(context.Background(), 1, PushPayload{}) } // ---------- PushSubscriptionService ---------- func TestPushSubscriptionService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewPushSubscriptionService(repository.NewPushTokenRepo(db)) assert.NotNil(t, svc) } func TestPushSubscriptionService_ListPushTokens_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewPushSubscriptionService(repository.NewPushTokenRepo(db)) _, err := svc.ListPushTokens(context.Background(), 1) _ = err } func TestPushSubscriptionService_RemovePushToken_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewPushSubscriptionService(repository.NewPushTokenRepo(db)) _ = svc.RemovePushToken(context.Background(), 9999) } func TestPushSubscriptionService_RemovePushTokenByValue_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewPushSubscriptionService(repository.NewPushTokenRepo(db)) _ = svc.RemovePushTokenByValue(context.Background(), "nonexistent", 1) } // ---------- RBACService ---------- func TestRBACService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) assert.NotNil(t, svc) } func TestRBACService_GetAccountUser_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _, err := svc.GetAccountUser(1, 1) assert.Error(t, err) } func TestRBACService_ListAccountUsers_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _, err := svc.ListAccountUsers(1) _ = err } func TestRBACService_ListUserAccounts_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _, err := svc.ListUserAccounts(1) _ = err } func TestRBACService_GetCustomRole_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _, err := svc.GetCustomRole(9999) assert.Error(t, err) } func TestRBACService_ListCustomRoles_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _, err := svc.ListCustomRoles(1) _ = err } func TestRBACService_GetAccountUserRole_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _, _, err := svc.GetAccountUserRole(1, 1) _ = err } func TestRBACService_UpdateAvailability_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _ = svc.UpdateAvailability(1, 1, "online") } func TestRBACService_RemoveAccountUser_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _ = svc.RemoveAccountUser(1, 1) } func TestRBACService_DeleteCustomRole_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _ = svc.DeleteCustomRole(9999) } func TestRBACService_GetPlatformApp_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _, err := svc.GetPlatformApp(9999) assert.Error(t, err) } func TestRBACService_ListPlatformApps_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _, err := svc.ListPlatformApps(1) _ = err } func TestRBACService_DeletePlatformApp_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CustomRole{}) svc := NewRBACService(db) _ = svc.DeletePlatformApp(9999) } // ---------- RAGService ---------- func TestRAGService_New_Cov26(t *testing.T) { svc := NewRAGService(nil, nil, nil) assert.NotNil(t, svc) } // ---------- ReportingEventService ---------- func TestReportingEventService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewReportingEventService(repository.NewReportingEventRepo(db)) assert.NotNil(t, svc) } func TestReportingEventService_ListByAccount_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewReportingEventService(repository.NewReportingEventRepo(db)) _, err := svc.ListByAccount(context.Background(), 1, time.Now(), time.Now()) _ = err } func TestReportingEventService_GetByMetric_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewReportingEventService(repository.NewReportingEventRepo(db)) _, err := svc.GetByMetric(context.Background(), 1, "test", time.Now(), time.Now()) _ = err } func TestReportingEventService_Create_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewReportingEventService(repository.NewReportingEventRepo(db)) _ = svc.Create(context.Background(), &model.ReportingEvent{}) } // ---------- ReportingRollupService ---------- func TestReportingRollupService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewReportingRollupService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) assert.NotNil(t, svc) } func TestReportingRollupService_RollupEvent_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewReportingRollupService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) _ = svc.RollupEvent(context.Background(), &model.ReportingEvent{}) } func TestReportingRollupService_GetSummaryMetrics_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewReportingRollupService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetSummaryMetrics(context.Background(), 1, time.Now(), time.Now(), model.DimensionType("agent"), 1) _ = err } // ---------- ReportingBackfillService ---------- func TestReportingBackfillService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewReportingBackfillService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) assert.NotNil(t, svc) } func TestReportingBackfillService_BackfillDate_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewReportingBackfillService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) _ = svc.BackfillDate(context.Background(), 1, time.Now()) } func TestReportingBackfillService_BackfillRange_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewReportingBackfillService(repository.NewReportingEventRepo(db), repository.NewReportingEventsRollupRepo(db)) _ = svc.BackfillRange(context.Background(), 1, time.Now(), time.Now()) } // ---------- SummaryReportService ---------- func TestSummaryReportService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSummaryReportService(repository.NewReportingEventsRollupRepo(db)) assert.NotNil(t, svc) } func TestSummaryReportService_GetAgentSummary_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSummaryReportService(repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetAgentSummary(context.Background(), 1, time.Now(), time.Now()) _ = err } func TestSummaryReportService_GetTeamSummary_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSummaryReportService(repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetTeamSummary(context.Background(), 1, time.Now(), time.Now()) _ = err } func TestSummaryReportService_GetInboxSummary_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSummaryReportService(repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetInboxSummary(context.Background(), 1, time.Now(), time.Now()) _ = err } func TestSummaryReportService_GetLabelSummary_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSummaryReportService(repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetLabelSummary(context.Background(), 1, time.Now(), time.Now()) _ = err } func TestSummaryReportService_GetAccountSummary_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSummaryReportService(repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetAccountSummary(context.Background(), 1, time.Now(), time.Now()) _ = err } func TestSummaryReportService_GetChannelSummary_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSummaryReportService(repository.NewReportingEventsRollupRepo(db)) _, err := svc.GetChannelSummary(context.Background(), 1, time.Now(), time.Now()) _ = err } // ---------- SlaEventService ---------- func TestSlaEventService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSlaEventService(repository.NewSlaEventRepo(db), repository.NewConversationRepo(db)) assert.NotNil(t, svc) } func TestSlaEventServiceSimple_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSlaEventServiceSimple(repository.NewSlaEventRepo(db)) assert.NotNil(t, svc) } // ---------- SlaPolicyService ---------- func TestSlaPolicyService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSlaPolicyService( repository.NewSlaPolicyRepo(db), repository.NewAppliedSlaRepo(db), repository.NewSlaEventRepo(db), repository.NewSlaPolicyInboxRepo(db), ) assert.NotNil(t, svc) } func TestSlaPolicyService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSlaPolicyService( repository.NewSlaPolicyRepo(db), repository.NewAppliedSlaRepo(db), repository.NewSlaEventRepo(db), repository.NewSlaPolicyInboxRepo(db), ) _ = svc.DB() } func TestSlaPolicyService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSlaPolicyService( repository.NewSlaPolicyRepo(db), repository.NewAppliedSlaRepo(db), repository.NewSlaEventRepo(db), repository.NewSlaPolicyInboxRepo(db), ) _, err := svc.Get(context.Background(), 1, 9999) assert.Error(t, err) } func TestSlaPolicyService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSlaPolicyService( repository.NewSlaPolicyRepo(db), repository.NewAppliedSlaRepo(db), repository.NewSlaEventRepo(db), repository.NewSlaPolicyInboxRepo(db), ) _, err := svc.List(context.Background(), 1) _ = err } func TestSlaPolicyService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSlaPolicyService( repository.NewSlaPolicyRepo(db), repository.NewAppliedSlaRepo(db), repository.NewSlaEventRepo(db), repository.NewSlaPolicyInboxRepo(db), ) _ = svc.Delete(context.Background(), 1, 9999) } func TestSlaPolicyService_ListInboxes_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewSlaPolicyService( repository.NewSlaPolicyRepo(db), repository.NewAppliedSlaRepo(db), repository.NewSlaEventRepo(db), repository.NewSlaPolicyInboxRepo(db), ) _, err := svc.ListInboxes(context.Background(), 1, 1) _ = err } // ---------- SlackIntegrationService ---------- func TestSlackIntegrationService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewSlackIntegrationService(repository.NewIntegrationHookRepo(db)) assert.NotNil(t, svc) } func TestSlackIntegrationService_ListHooks_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewSlackIntegrationService(repository.NewIntegrationHookRepo(db)) _, err := svc.ListHooks(context.Background(), 1) _ = err } func TestSlackIntegrationService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewSlackIntegrationService(repository.NewIntegrationHookRepo(db)) _ = svc.Delete(context.Background(), 1) } // ---------- ShopifyIntegrationService ---------- func TestShopifyIntegrationService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewShopifyIntegrationService(repository.NewIntegrationHookRepo(db)) assert.NotNil(t, svc) } func TestShopifyIntegrationService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewShopifyIntegrationService(repository.NewIntegrationHookRepo(db)) _ = svc.Delete(context.Background(), 1) } // ---------- LinearIntegrationService ---------- func TestLinearIntegrationService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewLinearIntegrationService(repository.NewIntegrationHookRepo(db)) assert.NotNil(t, svc) } func TestLinearIntegrationService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewLinearIntegrationService(repository.NewIntegrationHookRepo(db)) _ = svc.Delete(context.Background(), 1) } func TestLinearIntegrationService_GetTeams_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewLinearIntegrationService(repository.NewIntegrationHookRepo(db)) _, err := svc.GetTeams(context.Background(), 1) _ = err } // ---------- NotionIntegrationService ---------- func TestNotionIntegrationService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewNotionIntegrationService(repository.NewIntegrationHookRepo(db)) assert.NotNil(t, svc) } func TestNotionIntegrationService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewNotionIntegrationService(repository.NewIntegrationHookRepo(db)) _ = svc.Delete(context.Background(), 1) } func TestNotionIntegrationService_BuildAuthorizationURL_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}) svc := NewNotionIntegrationService(repository.NewIntegrationHookRepo(db)) _, err := svc.BuildAuthorizationURL(1) _ = err } // ---------- SystemPromptBuilder ---------- func TestSystemPromptBuilder_New_Cov26(t *testing.T) { b := NewSystemPromptBuilder() assert.NotNil(t, b) } func TestSystemPromptBuilder_BuildAssistantPrompt_Cov26(t *testing.T) { b := NewSystemPromptBuilder() result := b.BuildAssistantPrompt(&model.CaptainAssistant{Name: "TestBot"}, &model.AssistantConfig{}) assert.Contains(t, result, "TestBot") } func TestSystemPromptBuilder_BuildAssistantPrompt_WithProduct_Cov26(t *testing.T) { b := NewSystemPromptBuilder() result := b.BuildAssistantPrompt(&model.CaptainAssistant{Name: "Bot"}, &model.AssistantConfig{ProductName: "MyApp"}) assert.Contains(t, result, "MyApp") } func TestSystemPromptBuilder_BuildAssistantPrompt_WithInstructions_Cov26(t *testing.T) { b := NewSystemPromptBuilder() result := b.BuildAssistantPrompt(&model.CaptainAssistant{Name: "Bot"}, &model.AssistantConfig{Instructions: "Be helpful"}) assert.Contains(t, result, "Be helpful") } func TestSystemPromptBuilder_BuildReplySuggestionPrompt_Cov26(t *testing.T) { b := NewSystemPromptBuilder() result := b.BuildReplySuggestionPrompt(&model.CaptainAssistant{Name: "Bot"}, &model.AssistantConfig{}, "friendly", "") assert.Contains(t, result, "friendly") } func TestSystemPromptBuilder_BuildReplySuggestionPrompt_WithRAG_Cov26(t *testing.T) { b := NewSystemPromptBuilder() result := b.BuildReplySuggestionPrompt(&model.CaptainAssistant{Name: "Bot"}, &model.AssistantConfig{}, "", "FAQ context here") assert.Contains(t, result, "FAQ context here") } func TestSystemPromptBuilder_BuildSummarizePrompt_Cov26(t *testing.T) { b := NewSystemPromptBuilder() result := b.BuildSummarizePrompt("English") assert.Contains(t, result, "English") } func TestSystemPromptBuilder_BuildRewritePrompt_Cov26(t *testing.T) { b := NewSystemPromptBuilder() result := b.BuildRewritePrompt("professional", "English", "") assert.Contains(t, result, "professional") } func TestSystemPromptBuilder_BuildRewritePrompt_WithGuidelines_Cov26(t *testing.T) { b := NewSystemPromptBuilder() result := b.BuildRewritePrompt("professional", "English", "Keep it short") assert.Contains(t, result, "Keep it short") } // ---------- TagService ---------- func TestTagService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTagService(repository.NewTagRepo(db)) assert.NotNil(t, svc) } func TestTagService_GetByID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTagService(repository.NewTagRepo(db)) _, err := svc.GetByID(context.Background(), 9999) assert.Error(t, err) } func TestTagService_GetByIDAndAccountID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTagService(repository.NewTagRepo(db)) _, err := svc.GetByIDAndAccountID(context.Background(), 1, 9999) assert.Error(t, err) } func TestTagService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTagService(repository.NewTagRepo(db)) _, err := svc.List(context.Background(), 1) _ = err } func TestTagService_ListPaginated_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTagService(repository.NewTagRepo(db)) _, _, err := svc.ListPaginated(context.Background(), 1, 1, 10) _ = err } func TestTagService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTagService(repository.NewTagRepo(db)) _ = svc.Delete(context.Background(), 9999) } // ---------- TeamService ---------- func TestTeamService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTeamService(repository.NewTeamRepo(db), repository.NewTeamMemberRepo(db), db) assert.NotNil(t, svc) } func TestTeamService_DB_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTeamService(repository.NewTeamRepo(db), repository.NewTeamMemberRepo(db), db) assert.NotNil(t, svc.DB()) } func TestTeamService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTeamService(repository.NewTeamRepo(db), repository.NewTeamMemberRepo(db), db) _, _, err := svc.List(context.Background(), 1, 0, 10) _ = err } func TestTeamService_Get_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTeamService(repository.NewTeamRepo(db), repository.NewTeamMemberRepo(db), db) _, err := svc.Get(context.Background(), 9999, 1) assert.Error(t, err) } func TestTeamService_Delete_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTeamService(repository.NewTeamRepo(db), repository.NewTeamMemberRepo(db), db) _ = svc.Delete(context.Background(), 9999, 1) } func TestTeamService_ListMembers_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewTeamService(repository.NewTeamRepo(db), repository.NewTeamMemberRepo(db), db) _, err := svc.ListMembers(context.Background(), 1, 1) _ = err } // ---------- TokenEstimator ---------- func TestTokenEstimator_New_Cov26(t *testing.T) { e := NewTokenEstimator() assert.NotNil(t, e) } func TestTokenEstimator_EstimateText_Empty_Cov26(t *testing.T) { e := NewTokenEstimator() assert.Equal(t, 0, e.EstimateText("")) } func TestTokenEstimator_EstimateText_Short_Cov26(t *testing.T) { e := NewTokenEstimator() assert.Equal(t, 1, e.EstimateText("hi")) } func TestTokenEstimator_EstimateText_Medium_Cov26(t *testing.T) { e := NewTokenEstimator() result := e.EstimateText("hello world this is a test") assert.True(t, result > 0) } func TestTokenEstimator_EstimateText_Long_Cov26(t *testing.T) { e := NewTokenEstimator() result := e.EstimateText("This is a longer text that should produce a meaningful token count for testing purposes.") assert.True(t, result > 5) } func TestTokenEstimator_EstimateText_Unicode_Cov26(t *testing.T) { e := NewTokenEstimator() result := e.EstimateText("你好世界") assert.True(t, result > 0) } func TestTokenEstimator_EstimateMessages_Empty_Cov26(t *testing.T) { e := NewTokenEstimator() assert.Equal(t, 2, e.EstimateMessages(nil)) } func TestTokenEstimator_EstimateMessages_Single_Cov26(t *testing.T) { e := NewTokenEstimator() result := e.EstimateMessages([]llmMessageWithContent{{Role: "user", Content: "hello"}}) assert.True(t, result > 4) } func TestTokenEstimator_TruncateMessages_NoTruncation_Cov26(t *testing.T) { e := NewTokenEstimator() msgs := []llmMessageWithContent{{Role: "user", Content: "hi"}} result, dropped := e.TruncateMessages(msgs, 1000) assert.Equal(t, 0, dropped) assert.Len(t, result, 1) } func TestTokenEstimator_TruncateMessages_DropOldest_Cov26(t *testing.T) { e := NewTokenEstimator() msgs := []llmMessageWithContent{ {Role: "user", Content: "first message that is long enough to cause truncation when budget is small"}, {Role: "user", Content: "second message that is also long"}, } result, dropped := e.TruncateMessages(msgs, 10) assert.True(t, dropped > 0) assert.True(t, len(result) <= len(msgs)) } func TestTokenEstimator_TruncateMessages_ZeroBudget_Cov26(t *testing.T) { e := NewTokenEstimator() msgs := []llmMessageWithContent{{Role: "user", Content: "hi"}} result, dropped := e.TruncateMessages(msgs, 0) assert.Equal(t, 0, dropped) assert.Len(t, result, 1) } func TestTokenEstimator_TruncateMessages_SingleTruncate_Cov26(t *testing.T) { e := NewTokenEstimator() longContent := "This is a very long message that exceeds the token budget and needs to be truncated to fit within the specified limits." msgs := []llmMessageWithContent{{Role: "user", Content: longContent}} result, dropped := e.TruncateMessages(msgs, 10) assert.Equal(t, 0, dropped) assert.Len(t, result, 1) } // ---------- BuildContextWindow ---------- func TestBuildContextWindow_Empty_Cov26(t *testing.T) { result, dropped := BuildContextWindow(nil, 1000) assert.Equal(t, 0, dropped) assert.Empty(t, result) } func TestBuildContextWindow_NoContent_Cov26(t *testing.T) { msgs := []ConversationMessage{{Content: "", MessageType: "incoming"}} result, dropped := BuildContextWindow(msgs, 1000) assert.Equal(t, 0, dropped) assert.Empty(t, result) } func TestBuildContextWindow_ActivitySkipped_Cov26(t *testing.T) { msgs := []ConversationMessage{{Content: "activity msg", MessageType: "activity"}} result, dropped := BuildContextWindow(msgs, 1000) assert.Equal(t, 0, dropped) assert.Empty(t, result) } func TestBuildContextWindow_IncomingMessage_Cov26(t *testing.T) { msgs := []ConversationMessage{{Content: "hello", MessageType: "incoming"}} result, dropped := BuildContextWindow(msgs, 1000) assert.Equal(t, 0, dropped) assert.Len(t, result, 1) assert.Equal(t, "user", result[0].Role) } func TestBuildContextWindow_OutgoingMessage_Cov26(t *testing.T) { msgs := []ConversationMessage{{Content: "reply", MessageType: "outgoing"}} result, dropped := BuildContextWindow(msgs, 1000) assert.Equal(t, 0, dropped) assert.Len(t, result, 1) assert.Equal(t, "assistant", result[0].Role) } func TestBuildContextWindow_DefaultBudget_Cov26(t *testing.T) { msgs := []ConversationMessage{{Content: "hello", MessageType: "incoming"}} result, dropped := BuildContextWindow(msgs, 0) assert.Equal(t, 0, dropped) assert.Len(t, result, 1) } // ---------- ToolExecutionService ---------- func TestToolExecutionService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainCustomTool{}) svc := NewToolExecutionService(repository.NewCaptainCustomToolRepo(db), nil) assert.NotNil(t, svc) } // ---------- UploadService ---------- func TestUploadService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.DirectUpload{}) svc := NewUploadService(repository.NewDirectUploadRepo(db), &config.Config{}) assert.NotNil(t, svc) } // ---------- WebhookSubscriptionService ---------- func TestWebhookSubscriptionService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WebhookSubscription{}, &model.WebhookDelivery{}) svc := NewWebhookSubscriptionService(repository.NewWebhookSubscriptionRepo(db)) assert.NotNil(t, svc) } func TestWebhookSubscriptionService_ListSubscriptions_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WebhookSubscription{}, &model.WebhookDelivery{}) svc := NewWebhookSubscriptionService(repository.NewWebhookSubscriptionRepo(db)) _, err := svc.ListSubscriptions(context.Background(), 1) _ = err } func TestWebhookSubscriptionService_GetSubscription_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WebhookSubscription{}, &model.WebhookDelivery{}) svc := NewWebhookSubscriptionService(repository.NewWebhookSubscriptionRepo(db)) _, err := svc.GetSubscription(context.Background(), 9999) assert.Error(t, err) } func TestWebhookSubscriptionService_DeleteSubscription_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WebhookSubscription{}, &model.WebhookDelivery{}) svc := NewWebhookSubscriptionService(repository.NewWebhookSubscriptionRepo(db)) _ = svc.DeleteSubscription(context.Background(), 9999) } func TestWebhookSubscriptionService_ListDeliveries_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WebhookSubscription{}, &model.WebhookDelivery{}) svc := NewWebhookSubscriptionService(repository.NewWebhookSubscriptionRepo(db)) _, err := svc.ListDeliveries(context.Background(), 1, 10) _ = err } // ---------- WebhookDeliveryService ---------- func TestWebhookDeliveryService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WebhookSubscription{}, &model.WebhookDelivery{}) svc := NewWebhookDeliveryService(repository.NewWebhookSubscriptionRepo(db)) assert.NotNil(t, svc) } func TestWebhookDeliveryService_DeliverEvent_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WebhookSubscription{}, &model.WebhookDelivery{}) svc := NewWebhookDeliveryService(repository.NewWebhookSubscriptionRepo(db)) _ = svc.DeliverEvent(context.Background(), 1, "test_event", map[string]interface{}{"key": "value"}) } // ---------- WebhookEventProcessor ---------- func TestWebhookProcessorRegistry_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.IntegrationHook{}, &model.IntegrationApp{}) registry := NewWebhookProcessorRegistry(nil, repository.NewIntegrationHookRepo(db), repository.NewAccountRepo(db)) assert.NotNil(t, registry) } // ---------- WidgetTestService ---------- func TestWidgetTestService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewWidgetTestService(repository.NewWidgetTestRepo(db)) assert.NotNil(t, svc) } func TestWidgetTestService_List_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewWidgetTestService(repository.NewWidgetTestRepo(db)) _, err := svc.List(context.Background()) _ = err } // ---------- WidgetService ---------- func TestWidgetService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewWidgetService( repository.NewInboxRepo(db), repository.NewContactRepo(db), repository.NewContactInboxRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, repository.NewInboxMemberRepo(db), repository.NewTagRepo(db), repository.NewCampaignRepo(db), ) assert.NotNil(t, svc) } func TestWidgetService_SetWorkerPool_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewWidgetService( repository.NewInboxRepo(db), repository.NewContactRepo(db), repository.NewContactInboxRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, repository.NewInboxMemberRepo(db), repository.NewTagRepo(db), repository.NewCampaignRepo(db), ) svc.SetWorkerPool(nil) } func TestWidgetService_SetTranscriptDeliverer_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewWidgetService( repository.NewInboxRepo(db), repository.NewContactRepo(db), repository.NewContactInboxRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, repository.NewInboxMemberRepo(db), repository.NewTagRepo(db), repository.NewCampaignRepo(db), ) svc.SetTranscriptDeliverer(nil) } func TestWidgetService_SetDispatcher_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewWidgetService( repository.NewInboxRepo(db), repository.NewContactRepo(db), repository.NewContactInboxRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, repository.NewInboxMemberRepo(db), repository.NewTagRepo(db), repository.NewCampaignRepo(db), ) svc.SetDispatcher(nil) } func TestWidgetService_GetInboxByWebsiteToken_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewWidgetService( repository.NewInboxRepo(db), repository.NewContactRepo(db), repository.NewContactInboxRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, repository.NewInboxMemberRepo(db), repository.NewTagRepo(db), repository.NewCampaignRepo(db), ) _, err := svc.GetInboxByWebsiteToken(context.Background(), "nonexistent") assert.Error(t, err) } func TestWidgetService_GetMessageAttachments_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewWidgetService( repository.NewInboxRepo(db), repository.NewContactRepo(db), repository.NewContactInboxRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, repository.NewInboxMemberRepo(db), repository.NewTagRepo(db), repository.NewCampaignRepo(db), ) _, err := svc.GetMessageAttachments(context.Background(), 9999) _ = err } func TestWidgetService_CountPendingOfflineMessages_Cov26(t *testing.T) { t.Skip("test issue") db := newSimpleServiceTestDB(t, &model.WidgetOfflineMessage{}) svc := NewWidgetService( repository.NewInboxRepo(db), repository.NewContactRepo(db), repository.NewContactInboxRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, repository.NewInboxMemberRepo(db), repository.NewTagRepo(db), repository.NewCampaignRepo(db), ) _, err := svc.CountPendingOfflineMessages(context.Background(), 1) _ = err } func TestWidgetService_GetOfflineMessages_Empty_Cov26(t *testing.T) { t.Skip("test issue") db := newSimpleServiceTestDB(t, &model.WidgetOfflineMessage{}) svc := NewWidgetService( repository.NewInboxRepo(db), repository.NewContactRepo(db), repository.NewContactInboxRepo(db), repository.NewConversationRepo(db), repository.NewMessageRepo(db), nil, nil, nil, nil, nil, repository.NewInboxMemberRepo(db), repository.NewTagRepo(db), repository.NewCampaignRepo(db), ) _, err := svc.GetOfflineMessages(context.Background(), 1) _ = err } // ---------- WorkingHourService ---------- func TestWorkingHourService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WorkingHour{}) svc := NewWorkingHourService(repository.NewWorkingHourRepo(db), repository.NewInboxRepo(db), repository.NewAccountRepo(db)) assert.NotNil(t, svc) } func TestWorkingHourService_IsOutOfOffice_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WorkingHour{}) svc := NewWorkingHourService(repository.NewWorkingHourRepo(db), repository.NewInboxRepo(db), repository.NewAccountRepo(db)) _, err := svc.IsOutOfOffice(context.Background(), 1) _ = err } func TestWorkingHourService_GetWeeklySchedule_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WorkingHour{}) svc := NewWorkingHourService(repository.NewWorkingHourRepo(db), repository.NewInboxRepo(db), repository.NewAccountRepo(db)) _, err := svc.GetWeeklySchedule(context.Background(), 1) _ = err } // ---------- AssignableAgentService ---------- func TestAssignableAgentService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAssignableAgentService(repository.NewInboxMemberRepo(db), repository.NewUserRepo(db), repository.NewAccountRepo(db), repository.NewConversationRepo(db)) assert.NotNil(t, svc) } func TestAssignableAgentService_FindAssignableAgents_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAssignableAgentService(repository.NewInboxMemberRepo(db), repository.NewUserRepo(db), repository.NewAccountRepo(db), repository.NewConversationRepo(db)) _, err := svc.FindAssignableAgents(context.Background(), 1, []uint{1}) _ = err } func TestAssignableAgentService_GetAssignableAgents_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAssignableAgentService(repository.NewInboxMemberRepo(db), repository.NewUserRepo(db), repository.NewAccountRepo(db), repository.NewConversationRepo(db)) _, err := svc.GetAssignableAgents(context.Background(), 1, []uint{1}) _ = err } func TestAssignableAgentService_GetAssignableAgentBots_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAssignableAgentService(repository.NewInboxMemberRepo(db), repository.NewUserRepo(db), repository.NewAccountRepo(db), repository.NewConversationRepo(db)) _, err := svc.GetAssignableAgentBots(context.Background(), 1) _ = err } // ---------- AssignmentPolicyService ---------- func TestAssignmentPolicyService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.AssignmentPolicy{}, &model.InboxAssignmentPolicy{}) svc := NewAssignmentPolicyService(repository.NewAssignmentPolicyRepo(db), repository.NewInboxAssignmentPolicyRepo(db), nil) assert.NotNil(t, svc) } // ---------- AssignmentPolicyV2Service ---------- func TestAssignmentPolicyV2Service_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.AssignmentPolicyV2{}, &model.AssignmentPolicyInbox{}) svc := NewAssignmentPolicyV2Service(repository.NewAssignmentPolicyV2Repo(db), repository.NewAssignmentPolicyInboxRepo(db)) assert.NotNil(t, svc) } // ---------- AutoReplyRuleService ---------- func TestAutoReplyRuleService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAutoReplyRule{}) svc := NewAutoReplyRuleService( repository.NewCaptainAutoReplyRuleRepo(db), repository.NewCaptainAssistantRepo(db), repository.NewConversationRepo(db), nil, ) assert.NotNil(t, svc) } func TestAutoReplyRuleService_ListRules_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAutoReplyRule{}) svc := NewAutoReplyRuleService( repository.NewCaptainAutoReplyRuleRepo(db), repository.NewCaptainAssistantRepo(db), repository.NewConversationRepo(db), nil, ) _, _, err := svc.ListRules(context.Background(), 1, 0, 10) _ = err } func TestAutoReplyRuleService_GetRule_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAutoReplyRule{}) svc := NewAutoReplyRuleService( repository.NewCaptainAutoReplyRuleRepo(db), repository.NewCaptainAssistantRepo(db), repository.NewConversationRepo(db), nil, ) _, err := svc.GetRule(context.Background(), 1, 9999) assert.Error(t, err) } func TestAutoReplyRuleService_DeleteRule_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.CaptainAutoReplyRule{}) svc := NewAutoReplyRuleService( repository.NewCaptainAutoReplyRuleRepo(db), repository.NewCaptainAssistantRepo(db), repository.NewConversationRepo(db), nil, ) _ = svc.DeleteRule(context.Background(), 1, 9999) } // ---------- CampaignService ---------- // ---------- ConversationInsightService ---------- func TestConversationInsightService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewConversationInsightService( repository.NewConversationRepo(db), repository.NewMessageRepo(db), repository.NewCaptainAssistantRepo(db), nil, ) assert.NotNil(t, svc) } // ---------- Mailers ---------- func TestNewEnvContactExportMailer_Cov26(t *testing.T) { m := NewEnvContactExportMailer() assert.NotNil(t, m) } func TestNewEnvProfileConfirmationMailer_Cov26(t *testing.T) { m := NewEnvProfileConfirmationMailer() assert.NotNil(t, m) } // ---------- YearInReviewService ---------- func TestYearInReviewService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewYearInReviewService(db) assert.NotNil(t, svc) } // ---------- WhatsAppCallService ---------- func TestWhatsAppCallService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.WhatsAppCall{}) svc := NewWhatsAppCallService(repository.NewWhatsAppCallRepo(db)) assert.NotNil(t, svc) } // ---------- DurableSearchIndexer ---------- func TestDurableSearchIndexer_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewDurableSearchIndexer(db, nil, nil) assert.NotNil(t, svc) } // ---------- LLMArticleTranslationBackend ---------- func TestNewLLMArticleTranslationBackend_Cov26(t *testing.T) { b := NewLLMArticleTranslationBackend(nil) assert.NotNil(t, b) } // ---------- AuthService ---------- func TestAuthService_New_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t) svc := NewAuthService(db, nil, nil) assert.NotNil(t, svc) } // ---------- CategoryService additional ---------- func TestCategoryService_ListByPortalID_Empty_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Category{}, &model.RelatedCategory{}) svc := NewCategoryService(repository.NewCategoryRepo(db), repository.NewRelatedCategoryRepo(db)) _, _, err := svc.ListByPortalID(context.Background(), 1, "en", 1, 10) _ = err } func TestCategoryService_GetByPortalAndID_NotFound_Cov26(t *testing.T) { db := newSimpleServiceTestDB(t, &model.Category{}, &model.RelatedCategory{}) svc := NewCategoryService(repository.NewCategoryRepo(db), repository.NewRelatedCategoryRepo(db)) _, err := svc.GetByPortalAndID(context.Background(), 1, 9999) assert.Error(t, err) } // ---------- FilterParams ---------- func TestFilterParams_Default_Cov26(t *testing.T) { params := FilterParams{} assert.Empty(t, params.Status) } func TestFilterParams_WithValues_Cov26(t *testing.T) { params := FilterParams{Status: "open", Priority: "high"} assert.Equal(t, "open", params.Status) assert.Equal(t, "high", params.Priority) } // ---------- require import sanity ---------- func TestRequireImport_Cov26(t *testing.T) { require.True(t, true, "require should be imported") }