more tests

This commit is contained in:
Deluan 2016-02-29 22:22:50 -05:00
parent 64b9b3f13a
commit f4c893d6f3
1 changed files with 9 additions and 1 deletions

View File

@ -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)