refactor(artwork): move fakeFolderRepo to artwork_suite_test.go

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan 2026-07-26 22:25:52 -04:00
parent bf9d328c2a
commit fa879e1576
2 changed files with 21 additions and 25 deletions

View File

@ -11,6 +11,7 @@ import (
"github.com/navidrome/navidrome/core/storage"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/model/metadata"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo/v2"
@ -81,3 +82,23 @@ func (s *osDirStorage) FS() (storage.MusicFS, error) {
}
return osDirFS{os.DirFS(s.root)}, nil
}
// fakeFolderRepo covers the three FolderRepository methods the resolvers reach for; only the
// folder listing varies per spec, so the other two answer as an unremarkable library does.
type fakeFolderRepo struct {
model.FolderRepository
result []model.Folder
err error
}
func (f *fakeFolderRepo) GetAll(...model.QueryOptions) ([]model.Folder, error) {
return f.result, f.err
}
func (f *fakeFolderRepo) HasAudioOutsideFolders(model.Folder, []string) (bool, error) {
return false, nil
}
func (f *fakeFolderRepo) Get(string) (*model.Folder, error) {
return nil, model.ErrNotFound
}

View File

@ -1,25 +0,0 @@
package artwork
import (
"github.com/navidrome/navidrome/model"
)
// fakeFolderRepo covers the three FolderRepository methods the resolvers reach for; only the
// folder listing varies per spec, so the other two answer as an unremarkable library does.
type fakeFolderRepo struct {
model.FolderRepository
result []model.Folder
err error
}
func (f *fakeFolderRepo) GetAll(...model.QueryOptions) ([]model.Folder, error) {
return f.result, f.err
}
func (f *fakeFolderRepo) HasAudioOutsideFolders(model.Folder, []string) (bool, error) {
return false, nil
}
func (f *fakeFolderRepo) Get(string) (*model.Folder, error) {
return nil, model.ErrNotFound
}