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