mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-18 16:18:52 +01:00
Introduced engine.Scrobbler
Also refactored mocks into their original packages, to avoid cyclic references. Is there a better way to have mocks in GoLang tests?
This commit is contained in:
parent
4aa02e68e5
commit
b660a70688
16 changed files with 156 additions and 45 deletions
|
|
@ -7,8 +7,8 @@ import (
|
|||
"github.com/deluan/gosonic/consts"
|
||||
"github.com/deluan/gosonic/domain"
|
||||
"github.com/deluan/gosonic/engine"
|
||||
"github.com/deluan/gosonic/persistence"
|
||||
. "github.com/deluan/gosonic/tests"
|
||||
"github.com/deluan/gosonic/tests/mocks"
|
||||
"github.com/deluan/gosonic/utils"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
|
@ -35,11 +35,11 @@ const (
|
|||
func TestGetIndexes(t *testing.T) {
|
||||
Init(t, false)
|
||||
|
||||
mockRepo := mocks.CreateMockArtistIndexRepo()
|
||||
mockRepo := persistence.CreateMockArtistIndexRepo()
|
||||
utils.DefineSingleton(new(domain.ArtistIndexRepository), func() domain.ArtistIndexRepository {
|
||||
return mockRepo
|
||||
})
|
||||
propRepo := mocks.CreateMockPropertyRepo()
|
||||
propRepo := engine.CreateMockPropertyRepo()
|
||||
utils.DefineSingleton(new(engine.PropertyRepository), func() engine.PropertyRepository {
|
||||
return propRepo
|
||||
})
|
||||
|
|
@ -116,15 +116,15 @@ func TestGetIndexes(t *testing.T) {
|
|||
func TestGetMusicDirectory(t *testing.T) {
|
||||
Init(t, false)
|
||||
|
||||
mockArtistRepo := mocks.CreateMockArtistRepo()
|
||||
mockArtistRepo := persistence.CreateMockArtistRepo()
|
||||
utils.DefineSingleton(new(domain.ArtistRepository), func() domain.ArtistRepository {
|
||||
return mockArtistRepo
|
||||
})
|
||||
mockAlbumRepo := mocks.CreateMockAlbumRepo()
|
||||
mockAlbumRepo := persistence.CreateMockAlbumRepo()
|
||||
utils.DefineSingleton(new(domain.AlbumRepository), func() domain.AlbumRepository {
|
||||
return mockAlbumRepo
|
||||
})
|
||||
mockMediaFileRepo := mocks.CreateMockMediaFileRepo()
|
||||
mockMediaFileRepo := persistence.CreateMockMediaFileRepo()
|
||||
utils.DefineSingleton(new(domain.MediaFileRepository), func() domain.MediaFileRepository {
|
||||
return mockMediaFileRepo
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue