add test for deleting artists
This commit is contained in:
@@ -145,7 +145,7 @@ func TestUpdatedTags(t *testing.T) {
|
|||||||
is.Equal(updated.TagTitle, "title-upd") // updated has tags
|
is.Equal(updated.TagTitle, "title-upd") // updated has tags
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDelete(t *testing.T) {
|
func TestDeleteAlbum(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
is := is.NewRelaxed(t)
|
is := is.NewRelaxed(t)
|
||||||
m := mockfs.New(t)
|
m := mockfs.New(t)
|
||||||
@@ -154,13 +154,30 @@ func TestDelete(t *testing.T) {
|
|||||||
m.AddItems()
|
m.AddItems()
|
||||||
m.ScanAndClean()
|
m.ScanAndClean()
|
||||||
|
|
||||||
var album db.Album
|
is.NoErr(m.DB().Where("left_path=? AND right_path=?", "artist-2/", "album-2").Find(&db.Album{}).Error) // album exists
|
||||||
is.NoErr(m.DB().Where("left_path=? AND right_path=?", "artist-2/", "album-2").Find(&album).Error) // album exists
|
|
||||||
|
|
||||||
m.RemoveAll("artist-2/album-2")
|
m.RemoveAll("artist-2/album-2")
|
||||||
m.ScanAndClean()
|
m.ScanAndClean()
|
||||||
|
|
||||||
is.Equal(m.DB().Where("left_path=? AND right_path=?", "artist-2/", "album-2").Find(&album).Error, gorm.ErrRecordNotFound) // album doesn't exist
|
is.Equal(m.DB().Where("left_path=? AND right_path=?", "artist-2/", "album-2").Find(&db.Album{}).Error, gorm.ErrRecordNotFound) // album doesn't exist
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDeleteArtist(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
is := is.NewRelaxed(t)
|
||||||
|
m := mockfs.New(t)
|
||||||
|
defer m.CleanUp()
|
||||||
|
|
||||||
|
m.AddItems()
|
||||||
|
m.ScanAndClean()
|
||||||
|
|
||||||
|
is.NoErr(m.DB().Where("left_path=? AND right_path=?", "artist-2/", "album-2").Find(&db.Album{}).Error) // album exists
|
||||||
|
|
||||||
|
m.RemoveAll("artist-2")
|
||||||
|
m.ScanAndClean()
|
||||||
|
|
||||||
|
is.Equal(m.DB().Where("left_path=? AND right_path=?", "artist-2/", "album-2").Find(&db.Album{}).Error, gorm.ErrRecordNotFound) // album doesn't exist
|
||||||
|
is.Equal(m.DB().Where("name=?", "artist-2").Find(&db.Artist{}).Error, gorm.ErrRecordNotFound) // artist doesn't exist
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGenres(t *testing.T) {
|
func TestGenres(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user