refactor: remove album.GenreStrings
This commit is contained in:
@@ -181,7 +181,7 @@ func TestUpdatedAlbumGenre(t *testing.T) {
|
||||
|
||||
var album db.Album
|
||||
assert.NoError(t, m.DB().Preload("Genres").Where("left_path=? AND right_path=?", "artist-0/", "album-0").Find(&album).Error)
|
||||
assert.Equal(t, []string{"gen-a", "gen-b"}, album.GenreStrings())
|
||||
assert.Equal(t, []string{"gen-a", "gen-b"}, genreStrings(album))
|
||||
|
||||
m.SetTags("artist-0/album-0/track-0.flac", func(tags *mockfs.TagInfo) {
|
||||
tags.RawGenre = "gen-a-upd;gen-b-upd"
|
||||
@@ -191,7 +191,7 @@ func TestUpdatedAlbumGenre(t *testing.T) {
|
||||
|
||||
var updated db.Album
|
||||
assert.NoError(t, m.DB().Preload("Genres").Where("left_path=? AND right_path=?", "artist-0/", "album-0").Find(&updated).Error)
|
||||
assert.Equal(t, []string{"gen-a-upd", "gen-b-upd"}, updated.GenreStrings())
|
||||
assert.Equal(t, []string{"gen-a-upd", "gen-b-upd"}, genreStrings(updated))
|
||||
}
|
||||
|
||||
func TestDeleteAlbum(t *testing.T) {
|
||||
@@ -759,3 +759,11 @@ func TestMultiArtistPreload(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func genreStrings(album db.Album) []string {
|
||||
var strs []string
|
||||
for _, genre := range album.Genres {
|
||||
strs = append(strs, genre.Name)
|
||||
}
|
||||
return strs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user