Files
sendico/api/pkg/mutil/helpers/simple_test.go
Stephan D 62a6631b9a
All checks were successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
service backend
2025-11-07 18:35:26 +01:00

68 lines
1.5 KiB
Go

package helpers
import (
"testing"
factory "github.com/tech/sendico/pkg/mlogger/factory"
)
func TestNewTaskManagerFactory(t *testing.T) {
logger := factory.NewLogger(true)
// Test that factory doesn't panic with nil dependencies
taskManager := NewTaskManager(logger, nil, nil)
if taskManager == nil {
t.Fatal("Expected non-nil TaskManager")
}
}
func TestNewAccountManagerFactory(t *testing.T) {
logger := factory.NewLogger(true)
// Test that factory doesn't panic with nil dependencies
accountManager := NewAccountManager(
logger,
nil, nil, nil, nil,
)
if accountManager == nil {
t.Fatal("Expected non-nil AccountManager")
}
}
func TestFactoriesWithNilLogger(t *testing.T) {
// Test that factories handle nil logger gracefully
taskManager := NewTaskManager(nil, nil, nil)
if taskManager == nil {
t.Fatal("Expected non-nil TaskManager even with nil logger")
}
accountManager := NewAccountManager(
nil,
nil, nil, nil, nil,
)
if accountManager == nil {
t.Fatal("Expected non-nil AccountManager even with nil logger")
}
}
func TestFactoryTypesCompile(t *testing.T) {
// This test verifies that the factory functions return the expected interface types
logger := factory.NewLogger(true)
var taskManager TaskManager = NewTaskManager(logger, nil, nil)
var accountManager AccountManager = NewAccountManager(
logger,
nil, nil, nil, nil,
)
// These should not be nil
if taskManager == nil {
t.Fatal("TaskManager should not be nil")
}
if accountManager == nil {
t.Fatal("AccountManager should not be nil")
}
}