Skip to content

Commit

Permalink
Make mock default repeatability to 1 (#23)
Browse files Browse the repository at this point in the history
* Make mock default repeatability to 1

* remove unused test
  • Loading branch information
Fs02 committed Oct 13, 2021
1 parent f9367b0 commit 155426f
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type aggregate []*MockAggregate

func (a *aggregate) register(ctxData ctxData, query rel.Query, aggregate string, field string) *MockAggregate {
ma := &MockAggregate{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argQuery: query,
argAggregate: aggregate,
argField: field,
Expand Down
2 changes: 1 addition & 1 deletion assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (a Assert) assert(t T, mock interface{}) bool {
}

t.Helper()
if a.repeatability > 0 {
if a.repeatability > 1 {
t.Errorf("FAIL: Need to make %d more call(s) to satisfy mock:\n%s", a.repeatability-a.totalCalls, mock)
} else {
t.Errorf("FAIL: Mock defined but not called:\n%s", mock)
Expand Down
2 changes: 1 addition & 1 deletion count.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type count []*MockCount

func (c *count) register(ctxData ctxData, collection string, queriers ...rel.Querier) *MockCount {
mc := &MockCount{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argCollection: collection,
argQuery: rel.Build(collection, queriers...),
}
Expand Down
2 changes: 1 addition & 1 deletion delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type delete []*MockDelete

func (d *delete) register(ctxData ctxData, options ...rel.Cascade) *MockDelete {
md := &MockDelete{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argOptions: options,
}
*d = append(*d, md)
Expand Down
2 changes: 1 addition & 1 deletion delete_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type deleteAll []*MockDeleteAll

func (da *deleteAll) register(ctxData ctxData) *MockDeleteAll {
mda := &MockDeleteAll{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
}
*da = append(*da, mda)
return mda
Expand Down
2 changes: 1 addition & 1 deletion delete_any.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type deleteAny []*MockDeleteAny

func (da *deleteAny) register(ctxData ctxData, query rel.Query) *MockDeleteAny {
mda := &MockDeleteAny{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argQuery: query,
}
*da = append(*da, mda)
Expand Down
2 changes: 1 addition & 1 deletion exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type exec []*MockExec

func (e *exec) register(ctxData ctxData, statement string, args ...interface{}) *MockExec {
me := &MockExec{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argStatement: statement,
argArgs: args,
}
Expand Down
2 changes: 1 addition & 1 deletion find.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type find []*MockFind

func (f *find) register(ctxData ctxData, queriers ...rel.Querier) *MockFind {
mf := &MockFind{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argQuery: rel.Build("", queriers...),
}
*f = append(*f, mf)
Expand Down
2 changes: 1 addition & 1 deletion find_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type findAll []*MockFindAll

func (fa *findAll) register(ctxData ctxData, queriers ...rel.Querier) *MockFindAll {
mfa := &MockFindAll{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argQuery: rel.Build("", queriers...),
}
*fa = append(*fa, mfa)
Expand Down
2 changes: 1 addition & 1 deletion find_and_count_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type findAndCountAll []*MockFindAndCountAll

func (fca *findAndCountAll) register(ctxData ctxData, queriers ...rel.Querier) *MockFindAndCountAll {
mfca := &MockFindAndCountAll{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argQuery: rel.Build("", queriers...),
}
*fca = append(*fca, mfca)
Expand Down
2 changes: 1 addition & 1 deletion insert_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type insertAll []*MockInsertAll

func (ia *insertAll) register(ctxData ctxData) *MockInsertAll {
mia := &MockInsertAll{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
}
*ia = append(*ia, mia)
return mia
Expand Down
2 changes: 1 addition & 1 deletion iterate.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type iterate []*MockIterate

func (i *iterate) register(ctxData ctxData, query rel.Query, options ...rel.IteratorOption) *MockIterate {
mi := &MockIterate{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argQuery: query,
argOptions: options,
}
Expand Down
2 changes: 1 addition & 1 deletion mutate.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type mutate []*MockMutate

func (m *mutate) register(name string, ctxData ctxData, mutators ...rel.Mutator) *MockMutate {
mm := &MockMutate{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
name: name,
argMutators: mutators,
}
Expand Down
2 changes: 1 addition & 1 deletion preload.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type preload []*MockPreload

func (p *preload) register(ctxData ctxData, field string, queriers ...rel.Querier) *MockPreload {
mp := &MockPreload{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argField: field,
argQuery: rel.Build("", queriers...),
}
Expand Down
2 changes: 1 addition & 1 deletion update_any.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type updateAny []*MockUpdateAny

func (ua *updateAny) register(ctxData ctxData, query rel.Query, mutates ...rel.Mutate) *MockUpdateAny {
mua := &MockUpdateAny{
assert: &Assert{ctxData: ctxData},
assert: &Assert{ctxData: ctxData, repeatability: 1},
argQuery: query,
argMutates: mutates,
}
Expand Down

0 comments on commit 155426f

Please sign in to comment.