feat: add SyncAll periodic sync pipeline and wire Navidrome client into App
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
"naviwatcher/internal/config"
|
||||
"naviwatcher/internal/database"
|
||||
"naviwatcher/internal/navidrome"
|
||||
)
|
||||
|
||||
func TestAppRun_ScanLogsMissingReleases(t *testing.T) {
|
||||
@@ -135,6 +136,13 @@ func TestNewApp_CreatesMusicBrainzClient(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
// Inject an unauthenticated Navidrome client so the test needs no live server.
|
||||
prevFactory := navidromeClientFactory
|
||||
navidromeClientFactory = func(c config.NavidromeConfig) (*navidrome.NavidromeClient, error) {
|
||||
return navidrome.NewClientUnauthenticated(c), nil
|
||||
}
|
||||
defer func() { navidromeClientFactory = prevFactory }()
|
||||
|
||||
ctx := context.Background()
|
||||
app, err := NewApp(ctx, cfg, ":memory:")
|
||||
if err != nil {
|
||||
@@ -145,6 +153,9 @@ func TestNewApp_CreatesMusicBrainzClient(t *testing.T) {
|
||||
if app.mbClient == nil {
|
||||
t.Fatal("expected MusicBrainz client to be initialized, got nil")
|
||||
}
|
||||
if app.ndClient == nil {
|
||||
t.Fatal("expected Navidrome client to be initialized, got nil")
|
||||
}
|
||||
if app.db == nil {
|
||||
t.Fatal("expected database to be initialized, got nil")
|
||||
}
|
||||
@@ -170,6 +181,12 @@ func TestNewApp_GracefulShutdown(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
prevFactory := navidromeClientFactory
|
||||
navidromeClientFactory = func(c config.NavidromeConfig) (*navidrome.NavidromeClient, error) {
|
||||
return navidrome.NewClientUnauthenticated(c), nil
|
||||
}
|
||||
defer func() { navidromeClientFactory = prevFactory }()
|
||||
|
||||
ctx := context.Background()
|
||||
app, err := NewApp(ctx, cfg, ":memory:")
|
||||
if err != nil {
|
||||
@@ -197,6 +214,12 @@ func TestAppRun_GracefulShutdown(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
prevFactory := navidromeClientFactory
|
||||
navidromeClientFactory = func(c config.NavidromeConfig) (*navidrome.NavidromeClient, error) {
|
||||
return navidrome.NewClientUnauthenticated(c), nil
|
||||
}
|
||||
defer func() { navidromeClientFactory = prevFactory }()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
app, err := NewApp(ctx, cfg, ":memory:")
|
||||
|
||||
Reference in New Issue
Block a user