Skip to content

Commit

Permalink
Added mockery configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
begmaroman committed Jan 24, 2024
1 parent d9e0c8e commit f0ca2c7
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 102 deletions.
12 changes: 7 additions & 5 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,29 @@ packages:
github.com/0xPolygon/cdk-data-availability/client:
config:
interfaces:
ClientFactory:
Factory:
config:
mockname: ClientFactory
filename: client_factory.generated.go
Client:
config:
github.com/0xPolygon/cdk-data-availability/etherman:
config:
interfaces:
Etherman:
config:
github.com/0xPolygon/cdk-data-availability/sequencer:
github.com/0xPolygon/cdk-data-availability/synchronizer:
config:
interfaces:
ISequencerTracker:
SequencerTracker:
config:
filename: sequencer_tracker.generated.go
github.com/0xPolygon/cdk-data-availability/types:
config:
interfaces:
IEthClient:
EthClient:
config:
filename: eth_client.generated.go
IEthClientFactory:
EthClientFactory:
config:
filename: eth_client_factory.generated.go
17 changes: 11 additions & 6 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/ethereum/go-ethereum/common"
)

// ClientFactory interface for the client factory
type ClientFactory interface {
// Factory interface for the client factory
type Factory interface {
New(url string) Client
}

Expand All @@ -21,11 +21,16 @@ type Client interface {
SignSequence(signedSequence types.SignedSequence) ([]byte, error)
}

// Factory is the implementation of the data committee client factory
type Factory struct{}
// factory is the implementation of the data committee client factory
type factory struct{}

// NewFactory is the constructor of factory
func NewFactory() Factory {
return &factory{}
}

// New returns an implementation of the data committee node client
func (f *Factory) New(url string) Client {
func (f *factory) New(url string) Client {
return New(url)
}

Expand All @@ -35,7 +40,7 @@ type client struct {
}

// New returns a client ready to be used
func New(url string) *client {
func New(url string) Client {
return &client{
url: url,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func start(cliCtx *cli.Context) error {
cancelFuncs = append(cancelFuncs, detector.Stop)

batchSynchronizer, err := synchronizer.NewBatchSynchronizer(c.L1, selfAddr,
storage, detector.Subscribe(), etherman, sequencerTracker, &client.Factory{})
storage, detector.Subscribe(), etherman, sequencerTracker, client.NewFactory())
if err != nil {
log.Fatal(err)
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 25 additions & 25 deletions mocks/eth_client.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 21 additions & 21 deletions mocks/eth_client_factory.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f0ca2c7

Please sign in to comment.