mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-19 13:27:42 +03:00
more tests
This commit is contained in:
parent
64b9b3f13a
commit
f4c893d6f3
@ -14,6 +14,7 @@ func TestIndexRepository(t *testing.T) {
|
||||
|
||||
Convey("Subject: NewIndexRepository", t, func() {
|
||||
repo := NewArtistIndexRepository()
|
||||
|
||||
Convey("It should be able to read and write to the database", func() {
|
||||
i := &models.ArtistIndex{Id: "123"}
|
||||
|
||||
@ -22,13 +23,20 @@ func TestIndexRepository(t *testing.T) {
|
||||
|
||||
So(s, shouldBeEqual, i)
|
||||
})
|
||||
Convey("Put() should return error if Id is not set", func() {
|
||||
i := &models.ArtistIndex{}
|
||||
|
||||
err := repo.Put(i)
|
||||
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
Convey("Given that I have 4 records", func() {
|
||||
for i := 1; i <= 4; i++ {
|
||||
e := &models.ArtistIndex{Id: strconv.Itoa(i)}
|
||||
repo.Put(e)
|
||||
}
|
||||
|
||||
Convey("When I call GetAll", func() {
|
||||
Convey("When I call GetAll()", func() {
|
||||
indices, err := repo.GetAll()
|
||||
Convey("Then It should not return any error", func() {
|
||||
So(err, ShouldBeNil)
|
||||
|
Loading…
x
Reference in New Issue
Block a user