From 2b564074b5872c8f6638f8c2e5b573cd37091eba Mon Sep 17 00:00:00 2001 From: Deluan Date: Sun, 18 Jan 2026 21:38:54 -0500 Subject: [PATCH] fix(tests): initialize auth in AverageRating tests The toArtist and toArtistID3 functions call publicurl.ImageURL which requires auth.TokenAuth to be initialized. Without this, the tests panic with nil pointer dereference when calling CreatePublicToken. --- server/subsonic/helpers_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/subsonic/helpers_test.go b/server/subsonic/helpers_test.go index 8d86b0010..cb6875758 100644 --- a/server/subsonic/helpers_test.go +++ b/server/subsonic/helpers_test.go @@ -6,9 +6,11 @@ import ( "github.com/navidrome/navidrome/conf" "github.com/navidrome/navidrome/conf/configtest" + "github.com/navidrome/navidrome/core/auth" "github.com/navidrome/navidrome/model" "github.com/navidrome/navidrome/model/request" "github.com/navidrome/navidrome/server/subsonic/responses" + "github.com/navidrome/navidrome/tests" "github.com/navidrome/navidrome/utils/req" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -461,6 +463,8 @@ var _ = Describe("helpers", func() { var ctx context.Context BeforeEach(func() { + ds := &tests.MockDataStore{} + auth.Init(ds) ctx = context.Background() conf.Server.Subsonic.EnableAverageRating = true })