feat: add gomock testing
This commit is contained in:
parent
e39ea9e48f
commit
86da64fa41
1
go.mod
1
go.mod
|
@ -4,6 +4,7 @@ go 1.20
|
|||
|
||||
require (
|
||||
github.com/emirpasic/gods v1.18.1
|
||||
github.com/golang/mock v1.6.0
|
||||
github.com/google/go-cmp v0.6.0
|
||||
github.com/multiformats/go-multibase v0.2.0
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package interfaces
|
||||
|
||||
//go:generate mockgen -source=meta.go -destination=../mocks/interfaces/meta.go -package=interfaces
|
||||
|
||||
type Metadata interface {
|
||||
ToJson() map[string]interface{}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
//go:generate mockgen -source=node.go -destination=../mocks/interfaces/node.go -package=interfaces
|
||||
|
||||
type Node interface {
|
||||
Services() Services
|
||||
HashQueryRoutingTable() structs.Map
|
||||
|
|
|
@ -7,6 +7,8 @@ import (
|
|||
"net/url"
|
||||
)
|
||||
|
||||
//go:generate mockgen -source=p2p.go -destination=../mocks/interfaces/p2p.go -package=interfaces
|
||||
|
||||
type P2PService interface {
|
||||
Node() Node
|
||||
Peers() structs.Map
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package interfaces
|
||||
|
||||
//go:generate mockgen -source=service.go -destination=../mocks/interfaces/service.go -package=interfaces
|
||||
|
||||
type Service interface {
|
||||
Node() Node
|
||||
Start() error
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package interfaces
|
||||
|
||||
//go:generate mockgen -source=storage.go -destination=../mocks/interfaces/storage.go -package=interfaces
|
||||
|
||||
type StorageLocation interface {
|
||||
BytesURL() string
|
||||
OutboardBytesURL() string
|
||||
|
|
|
@ -2,6 +2,8 @@ package interfaces
|
|||
|
||||
import "github.com/vmihailenco/msgpack/v5"
|
||||
|
||||
//go:generate mockgen -source=vote.go -destination=../mocks/interfaces/vote.go -package=interfaces
|
||||
|
||||
type NodeVotes interface {
|
||||
msgpack.CustomEncoder
|
||||
msgpack.CustomDecoder
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"github.com/vmihailenco/msgpack/v5"
|
||||
)
|
||||
|
||||
//go:generate mockgen -source=incoming_message.go -destination=../mocks/base/incoming_message.go -package=base
|
||||
|
||||
type IncomingMessage interface {
|
||||
HandleMessage(node interfaces.Node, peer net.Peer, verifyId bool) error
|
||||
SetIncomingMessage(msg IncomingMessage)
|
||||
|
|
Loading…
Reference in New Issue