Refactored purgeInactive, better test suite setup

This commit is contained in:
Deluan
2020-01-10 19:20:29 -05:00
committed by Deluan Quintão
parent ef79f6342f
commit 9ccd9545e8
7 changed files with 47 additions and 48 deletions
+29
View File
@@ -3,6 +3,7 @@ package storm
import (
"testing"
"github.com/cloudsonic/sonic-server/domain"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -12,3 +13,31 @@ func TestStormPersistence(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Storm Persistence Suite")
}
var testAlbums = domain.Albums{
{ID: "1", Name: "Sgt Peppers", Artist: "The Beatles", ArtistID: "1"},
{ID: "2", Name: "Abbey Road", Artist: "The Beatles", ArtistID: "1"},
{ID: "3", Name: "Radioactivity", Artist: "Kraftwerk", ArtistID: "2", Starred: true},
}
var testArtists = domain.Artists{
{ID: "1", Name: "Saara Saara"},
{ID: "2", Name: "Kraftwerk"},
{ID: "3", Name: "The Beatles"},
}
var _ = Describe("Initialize test DB", func() {
BeforeSuite(func() {
Db().Drop(&_Album{})
albumRepo := NewAlbumRepository()
for _, a := range testAlbums {
albumRepo.Put(&a)
}
Db().Drop(&_Artist{})
artistRepo := NewArtistRepository()
for _, a := range testArtists {
artistRepo.Put(&a)
}
})
})