1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-07 21:47:02 +09:00

anymock helper

This commit is contained in:
Sergey Cherepanov 2024-04-03 12:36:18 +02:00
parent 3a3be11416
commit c6ac38edb3
No known key found for this signature in database
GPG key ID: 87F8EDE8FBDF637C

View file

@ -0,0 +1,22 @@
package anymock
import "go.uber.org/mock/gomock"
type MockComp interface {
Name() *gomock.Call
Init(x any) *gomock.Call
}
type MockCompRunnable interface {
Run(x any) *gomock.Call
Close(x any) *gomock.Call
}
func ExpectComp(c MockComp, name string) {
c.Name().Return(name).AnyTimes()
c.Init(gomock.Any()).AnyTimes()
if cr, ok := c.(MockCompRunnable); ok {
cr.Run(gomock.Any()).AnyTimes()
cr.Close(gomock.Any()).AnyTimes()
}
}