Files
gochat/backend/internal/service/coverage41_test.go
T

184 lines
5.3 KiB
Go

package service
import (
"context"
"testing"
"github.com/gochat/gochat/internal/repository"
)
func newWidgetSvc_Cov41(t *testing.T) *WidgetService {
db := newSimpleServiceTestDB(t)
return NewWidgetService(
repository.NewInboxRepo(db),
repository.NewContactRepo(db),
repository.NewContactInboxRepo(db),
repository.NewConversationRepo(db),
repository.NewMessageRepo(db),
nil,
repository.NewWidgetThemeConfigRepo(db),
repository.NewPreChatFormRepo(db),
repository.NewWidgetFileUploadRepo(db),
repository.NewWidgetOfflineMessageRepo(db),
repository.NewInboxMemberRepo(db),
repository.NewTagRepo(db),
repository.NewCampaignRepo(db),
)
}
func TestWidgetService_GetConversations_DB_Cov41(t *testing.T) {
svc := newWidgetSvc_Cov41(t)
_, _ = svc.GetConversations(context.Background(), "nonexistent")
}
func TestWidgetService_GetLatestConversation_DB_Cov41(t *testing.T) {
svc := newWidgetSvc_Cov41(t)
_, _ = svc.GetLatestConversation(context.Background(), "nonexistent")
}
func TestWidgetService_UpdateContact_DB_Cov41(t *testing.T) {
svc := newWidgetSvc_Cov41(t)
_, _ = svc.UpdateContact(context.Background(), "", "", "")
}
func TestWidgetService_GetContact_DB_Cov41(t *testing.T) {
svc := newWidgetSvc_Cov41(t)
_, _ = svc.GetContact(context.Background(), "nonexistent")
}
func TestWidgetService_SendMessage_DB_Cov41(t *testing.T) {
svc := newWidgetSvc_Cov41(t)
_, _ = svc.SendMessage(context.Background(), WidgetSendMessageRequest{})
}
func TestWidgetService_Init_DB_Cov41(t *testing.T) {
svc := newWidgetSvc_Cov41(t)
_, _ = svc.Init(context.Background(), WidgetInitRequest{WebsiteToken: "test"})
}
func TestWidgetService_ToggleTyping_DB_Cov41(t *testing.T) {
svc := newWidgetSvc_Cov41(t)
_ = svc.ToggleTyping(context.Background(), "", 1, true)
}
func TestWidgetService_PublicListMessages_DB_Cov41(t *testing.T) {
svc := newWidgetSvc_Cov41(t)
_, _, _, _ = svc.PublicListMessages(context.Background(), "", "", 0, PublicMessageListOptions{})
}
func TestInboxService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewInboxRepo(db)
svc := NewInboxService(repo, nil, nil, nil, nil, nil, nil)
_, _ = svc.GetByID(context.Background(), 1)
}
func TestConversationService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
convRepo := repository.NewConversationRepo(db)
msgRepo := repository.NewMessageRepo(db)
svc := NewConversationService(convRepo, msgRepo, nil, nil, nil, nil, nil)
_, _ = svc.GetByID(context.Background(), 1)
}
func TestContactService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewContactRepo(db)
svc := NewContactService(repo, nil, nil)
_, _ = svc.GetByID(context.Background(), 1)
_, _, _ = svc.ListByAccount(context.Background(), 1, 0, 20, "name")
}
func TestTagService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewTagRepo(db)
svc := NewTagService(repo)
_, _ = svc.GetByID(context.Background(), 1)
}
func TestNoteService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewNoteRepo(db)
svc := NewNoteService(repo)
_ = svc
}
func TestBannerService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewBannerRepo(db)
svc := NewBannerService(repo)
_, _, _ = svc.List(context.Background(), 0, 20)
}
func TestTeamService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewTeamRepo(db)
memberRepo := repository.NewTeamMemberRepo(db)
svc := NewTeamService(repo, memberRepo, db)
_, _, _ = svc.List(context.Background(), 1, 0, 20)
}
func TestAccountService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewAccountRepo(db)
svc := NewAccountService(repo)
_, _ = svc.GetByID(context.Background(), 1)
}
func TestAgentService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewAgentRepo(db)
svc := NewAgentService(repo, db)
_ = svc
}
func TestDashboardAppService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewDashboardAppRepo(db)
svc := NewDashboardAppService(repo)
_ = svc
}
func TestInstallationConfigService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewInstallationConfigRepo(db)
svc := NewInstallationConfigService(repo)
_ = svc
}
func TestDraftMessageService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewDraftMessageRepo(db)
convRepo := repository.NewConversationRepo(db)
svc := NewDraftMessageService(repo, convRepo)
_ = svc
}
func TestContactInboxService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewContactInboxRepo(db)
svc := NewContactInboxService(repo)
_, _ = svc.ListByContact(context.Background(), 1)
}
func TestCaptainDocumentService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewCaptainDocumentRepo(db)
_ = repo
}
func TestDeliveryStatusService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewDeliveryStatusRepo(db)
msgRepo := repository.NewMessageRepo(db)
svc := NewDeliveryStatusService(msgRepo, repo)
_ = svc
}
func TestReportingEventService_DB_Cov41(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewReportingEventRepo(db)
svc := NewReportingEventService(repo)
_ = svc
}