Skip to content

Commit

Permalink
Merge pull request #9 from TerrexTech/fix-testfiles
Browse files Browse the repository at this point in the history
Fix test-files
  • Loading branch information
Jaskaranbir authored Oct 22, 2018
2 parents 418bc2d + 682314b commit 81acb83
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions ioutil/eventstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,16 @@ var _ = Describe("EventStore", func() {
events, err := eventtore.GetAggEvents(query, 40)
Expect(err).ToNot(HaveOccurred())

Expect(*events).To(HaveLen(2))
Expect(events).To(HaveLen(2))

e0 := (*events)[0]
e0 := events[0]
mockEvent.Version = 13
// Convert timestamps to consistent formats
mockEvent.Timestamp = time.Unix(mockEvent.Timestamp.Unix(), 0)
e0.Timestamp = time.Unix(e0.Timestamp.Unix(), 0)
Expect(reflect.DeepEqual(e0, mockEvent)).To(BeTrue())

e1 := (*events)[1]
e1 := events[1]
mockEvent.Version = 11
e1.Timestamp = time.Unix(e1.Timestamp.Unix(), 0)
Expect(reflect.DeepEqual(e1, mockEvent)).To(BeTrue())
Expand Down
6 changes: 3 additions & 3 deletions ioutil/queryutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ var _ = Describe("QueryUtil", func() {
Expect(reflect.DeepEqual(q, mockEventStoreQuery)).To(BeTrue())
return mockMetaVer, nil
},
MockEvents: func(q *model.EventStoreQuery, mv int64) (*[]model.Event, error) {
MockEvents: func(q *model.EventStoreQuery, mv int64) ([]model.Event, error) {
Expect(q.AggregateID).To(Equal(mockEventStoreQuery.AggregateID))
Expect(q.AggregateVersion).To(Equal(mockEventStoreQuery.AggregateVersion))

Expect(mv).To(Equal(mockMetaVer))
return &mockEvents, nil
return mockEvents, nil
},
}

Expand Down Expand Up @@ -110,7 +110,7 @@ var _ = Describe("QueryUtil", func() {
Expect(reflect.DeepEqual(q, mockEventStoreQuery)).To(BeTrue())
return mockMetaVer, nil
},
MockEvents: func(q *model.EventStoreQuery, mv int64) (*[]model.Event, error) {
MockEvents: func(q *model.EventStoreQuery, mv int64) ([]model.Event, error) {
return nil, errors.New("some-error")
},
}
Expand Down
6 changes: 3 additions & 3 deletions mock/eventstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

// MEventStore is a mock for ioutil.EventStore.
type MEventStore struct {
MockEvents func(*model.EventStoreQuery, int64) (*[]model.Event, error)
MockEvents func(*model.EventStoreQuery, int64) ([]model.Event, error)
MockMetaVersion func(*model.EventStoreQuery) (int64, error)
}

Expand All @@ -25,10 +25,10 @@ func (dbu *MEventStore) GetAggMetaVersion(
func (dbu *MEventStore) GetAggEvents(
eventStoreQuery *model.EventStoreQuery,
eventMetaVersion int64,
) (*[]model.Event, error) {
) ([]model.Event, error) {
if dbu.MockMetaVersion != nil {
return dbu.MockEvents(eventStoreQuery, eventMetaVersion)
}

return &[]model.Event{}, nil
return []model.Event{}, nil
}

0 comments on commit 81acb83

Please sign in to comment.