package tests
import (
"context"
"github.com/deluan/rest"
"github.com/navidrome/navidrome/model"
)
type MockLibraryService struct {
*MockLibraryRepo
}
type MockLibraryRestAdapter struct {
*MockLibraryRepo
}
func NewMockLibraryService() *MockLibraryService {
repo := &MockLibraryRepo{
Data: make(map[int]model.Library),
}
repo.SetData(model.Libraries{
{ID: 1, Name: "Test Library 1", Path: "/music/library1"},
{ID: 2, Name: "Test Library 2", Path: "/music/library2"},
})
return &MockLibraryService{MockLibraryRepo: repo}
}
func (m *MockLibraryService) NewRepository(ctx context.Context) rest.Repository {
return &MockLibraryRestAdapter{MockLibraryRepo: m.MockLibraryRepo}
}
func (a *MockLibraryRestAdapter) Delete(id string) error {
return a.DeleteByStringID(id)
}