2020-01-28 04:22:17 -09:00
|
|
|
package persistence_test
|
2020-01-15 13:49:09 -09:00
|
|
|
|
|
|
|
|
import (
|
2020-04-26 08:06:38 -08:00
|
|
|
"context"
|
|
|
|
|
|
2020-01-19 11:37:41 -09:00
|
|
|
"github.com/astaxie/beego/orm"
|
2020-01-31 05:53:19 -09:00
|
|
|
"github.com/navidrome/navidrome/log"
|
2020-01-23 15:44:08 -09:00
|
|
|
"github.com/navidrome/navidrome/model"
|
2020-01-28 04:22:17 -09:00
|
|
|
"github.com/navidrome/navidrome/persistence"
|
2020-01-15 13:49:09 -09:00
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var _ = Describe("GenreRepository", func() {
|
|
|
|
|
var repo model.GenreRepository
|
|
|
|
|
|
|
|
|
|
BeforeEach(func() {
|
2020-04-26 08:06:38 -08:00
|
|
|
repo = persistence.NewGenreRepository(log.NewContext(context.TODO()), orm.NewOrm())
|
2020-01-15 13:49:09 -09:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("returns all records", func() {
|
|
|
|
|
genres, err := repo.GetAll()
|
|
|
|
|
Expect(err).To(BeNil())
|
2021-07-16 07:03:28 -08:00
|
|
|
Expect(genres).To(ConsistOf(
|
|
|
|
|
model.Genre{ID: "gn-1", Name: "Electronic", AlbumCount: 1, SongCount: 2},
|
2021-07-16 13:15:34 -08:00
|
|
|
model.Genre{ID: "gn-2", Name: "Rock", AlbumCount: 3, SongCount: 3},
|
2021-07-16 07:03:28 -08:00
|
|
|
))
|
2020-01-15 13:49:09 -09:00
|
|
|
})
|
|
|
|
|
})
|