Fixed an allocation bug, and tests

This commit is contained in:
Deluan
2016-02-29 22:39:36 -05:00
parent f4c893d6f3
commit b869843986
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ func (r *ArtistIndex) Get(id string) (*models.ArtistIndex, error) {
} }
func (r *ArtistIndex) GetAll() ([]models.ArtistIndex, error) { func (r *ArtistIndex) GetAll() ([]models.ArtistIndex, error) {
var indices = make([]models.ArtistIndex, 30) var indices = make([]models.ArtistIndex, 0)
err := r.loadAll(&indices) err := r.loadAll(&indices)
return indices, err return indices, err
} }
+3 -3
View File
@@ -41,10 +41,10 @@ func TestIndexRepository(t *testing.T) {
Convey("Then It should not return any error", func() { Convey("Then It should not return any error", func() {
So(err, ShouldBeNil) So(err, ShouldBeNil)
}) })
SkipConvey("And It should return 4 entities", func() { Convey("And It should return 4 entities", func() {
So(len(indices), ShouldEqual, 4) So(indices, ShouldHaveLength, 4)
}) })
SkipConvey("And the values should be retrieved", func() { Convey("And the values should be retrieved", func() {
for _, e := range indices { for _, e := range indices {
So(e.Id, ShouldBeIn, []string{"1", "2", "3", "4"}) So(e.Id, ShouldBeIn, []string{"1", "2", "3", "4"})
} }