From f4c893d6f3f1fc9be6929a52abc14133897d6d04 Mon Sep 17 00:00:00 2001 From: Deluan Date: Mon, 29 Feb 2016 22:22:50 -0500 Subject: [PATCH] more tests --- repositories/index_repository_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/repositories/index_repository_test.go b/repositories/index_repository_test.go index 238606dd0..d0cea28ab 100644 --- a/repositories/index_repository_test.go +++ b/repositories/index_repository_test.go @@ -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)