Skip to content

Commit c0a8871

Browse files
committed
add godocs for MatchLock
1 parent 066e2c1 commit c0a8871

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

utils/unittest/mocks/matchers.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ import (
55
"github.com/stretchr/testify/mock"
66
)
77

8+
// MatchLock returns an argument matcher that checks if the argument is a `lockctx.Proof` that holds
9+
// the provided lock.
10+
//
11+
// Example:
12+
//
13+
// events.
14+
// On("BatchStore", mocks.MatchLock(storage.LockInsertEvent), blockID, expectedEvents, mock.Anything).
15+
// Return(func(lctx lockctx.Proof, blockID flow.Identifier, events []flow.EventsList, batch storage.ReaderBatchWriter) error {
16+
// require.NotNil(t, batch)
17+
// return nil
18+
// }).
19+
// Once()
820
func MatchLock(lock string) interface{} {
921
return mock.MatchedBy(func(lctx lockctx.Proof) bool { return lctx.HoldsLock(lock) })
1022
}

0 commit comments

Comments
 (0)