This commit is contained in:
ItalyPaleAle
2026-07-11 12:19:04 -07:00
parent 69a6e22c7c
commit e4d0cbefbe
36 changed files with 824 additions and 970 deletions
@@ -0,0 +1,25 @@
//go:build unit
// This file contains utils for unit tests and it's only built when the "unit" tag is set
package appconfig
import (
"sync/atomic"
"github.com/pocket-id/pocket-id/backend/internal/model"
)
// NewTestAppConfigService is a function used by tests to create AppConfigService objects with pre-defined configuration values
func NewTestAppConfigService(config *model.AppConfig) *AppConfigService {
if config == nil {
// If there's no config, set the default one
config = getDefaultDbConfig()
}
service := &AppConfigService{
dbConfig: atomic.Pointer[model.AppConfig]{},
}
service.dbConfig.Store(config)
return service
}