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

72 lines
1.9 KiB
Go

package service
import (
"context"
"testing"
"github.com/gochat/gochat/internal/repository"
"github.com/stretchr/testify/require"
)
// DB-backed tests for services - these actually execute code paths
// ContactService DB-backed tests
// ConversationService DB-backed tests
func TestConversationService_GetByID_NotFound_DB_Cov47(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewConversationRepo(db)
msgRepo := repository.NewMessageRepo(db)
svc := NewConversationService(repo, msgRepo, nil, nil, nil, nil, nil)
_, err := svc.GetByID(context.Background(), 999)
require.Error(t, err)
}
func TestConversationService_AssignAgent_DB_Cov47(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewConversationRepo(db)
msgRepo := repository.NewMessageRepo(db)
svc := NewConversationService(repo, msgRepo, nil, nil, nil, nil, nil)
_, err := svc.AssignAgent(context.Background(), 1, 1, 1)
_ = err
}
// MessageService DB-backed tests
func TestMessageService_GetByID_NotFound_DB_Cov47(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewMessageRepo(db)
svc := NewMessageService(repo, nil, nil)
_, err := svc.GetByID(context.Background(), 999)
require.Error(t, err)
}
// AnalyticsService DB-backed tests
// ArticleService DB-backed tests
// BannerService DB-backed tests
// DashboardAppService DB-backed tests
func TestDashboardAppService_GetByID_DB_Cov47(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewDashboardAppRepo(db)
svc := NewDashboardAppService(repo)
_, err := svc.GetByID(context.Background(), 1)
_ = err
}
// FolderService DB-backed tests
// InstallationConfigService DB-backed tests
func TestInstallationConfigService_GetByName_DB_Cov47(t *testing.T) {
db := newSimpleServiceTestDB(t)
repo := repository.NewInstallationConfigRepo(db)
svc := NewInstallationConfigService(repo)
_, err := svc.GetByName(context.Background(), "test")
_ = err
}