mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-15 05:47:13 +02:00
refactor(lyrics): address review feedback on sidecar FS read
- Move blank local-storage import from sources.go into lyrics_suite_test.go (the test suite already imports the local package for RegisterExtractor, so local's init() runs; production binaries get the scheme via normal wiring) - Fix misleading comment: model.ParseLyrics → model.ParseLyricsFile - Replace what-comment with why-comment in BeforeSuite explaining the log.Fatal guard that requires the no-op extractor registration
This commit is contained in:
parent
60c2a78396
commit
6672bb52ef
3 changed files with 4 additions and 4 deletions
|
|
@ -20,8 +20,9 @@ func TestLyrics(t *testing.T) {
|
|||
RunSpecs(t, "Lyrics Suite")
|
||||
}
|
||||
|
||||
// Register a no-op extractor so that storage.For("file://...") works in tests.
|
||||
// The lyrics package only needs FS() for sidecar reads; ReadTags is never called.
|
||||
// core/storage/local calls log.Fatal if the default scanner extractor is unregistered
|
||||
// when constructing any localStorage. Register a no-op so storage.For("file://...") works
|
||||
// in tests without importing the real extractor.
|
||||
var _ = BeforeSuite(func() {
|
||||
local.RegisterExtractor(consts.DefaultScannerExtractor, func(fs.FS, string) local.Extractor {
|
||||
return &noopExtractor{}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import (
|
|||
"path"
|
||||
|
||||
"github.com/navidrome/navidrome/core/storage"
|
||||
_ "github.com/navidrome/navidrome/core/storage/local"
|
||||
"github.com/navidrome/navidrome/log"
|
||||
"github.com/navidrome/navidrome/model"
|
||||
"github.com/navidrome/navidrome/utils/ioutils"
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ var _ = Describe("sources", func() {
|
|||
Expect(lyrics).To(HaveLen(0))
|
||||
})
|
||||
|
||||
// fromExternalFile delegates format parsing to model.ParseLyrics; the
|
||||
// fromExternalFile delegates format parsing to model.ParseLyricsFile; the
|
||||
// per-format parser output is covered exhaustively in the model package.
|
||||
// Here we only verify each suffix is read from the library FS and routed.
|
||||
DescribeTable("should read the sidecar file and route its suffix to a parser",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue