mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-19 16:24:13 +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() {
|
Convey("Subject: NewIndexRepository", t, func() {
|
||||||
repo := NewArtistIndexRepository()
|
repo := NewArtistIndexRepository()
|
||||||
|
|
||||||
Convey("It should be able to read and write to the database", func() {
|
Convey("It should be able to read and write to the database", func() {
|
||||||
i := &models.ArtistIndex{Id: "123"}
|
i := &models.ArtistIndex{Id: "123"}
|
||||||
|
|
||||||
@ -22,13 +23,20 @@ func TestIndexRepository(t *testing.T) {
|
|||||||
|
|
||||||
So(s, shouldBeEqual, i)
|
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() {
|
Convey("Given that I have 4 records", func() {
|
||||||
for i := 1; i <= 4; i++ {
|
for i := 1; i <= 4; i++ {
|
||||||
e := &models.ArtistIndex{Id: strconv.Itoa(i)}
|
e := &models.ArtistIndex{Id: strconv.Itoa(i)}
|
||||||
repo.Put(e)
|
repo.Put(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
Convey("When I call GetAll", func() {
|
Convey("When I call GetAll()", func() {
|
||||||
indices, err := repo.GetAll()
|
indices, err := repo.GetAll()
|
||||||
Convey("Then It should not return any error", func() {
|
Convey("Then It should not return any error", func() {
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user