Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite mockery generation through go:generate command #200

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ run-unprocessed-events-replay-local:
--finality-providers config/finality-providers.json \
--replay

generate-mock-interface:
cd internal/shared/db/client && mockery --name=DBClient --output=../../../../tests/mocks --outpkg=mocks --filename=mock_db_client.go
cd internal/v1/db/client && mockery --name=V1DBClient --output=../../../../tests/mocks --outpkg=mocks --filename=mock_v1_db_client.go
cd internal/v2/db/client && mockery --name=V2DBClient --output=../../../../tests/mocks --outpkg=mocks --filename=mock_v2_db_client.go
cd internal/shared/http/clients/ordinals && mockery --name=OrdinalsClient --output=../../../../../tests/mocks --outpkg=mocks --filename=mock_ordinal_client.go
generate:
go generate ./...

test:
./bin/local-startup.sh;
Expand Down
1 change: 1 addition & 0 deletions internal/shared/db/client/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
dbmodel "github.com/babylonlabs-io/staking-api-service/internal/shared/db/model"
)

//go:generate mockery --name=DBClient --output=../../../../tests/mocks --outpkg=mocks --filename=mock_db_client.go
type DBClient interface {
Ping(ctx context.Context) error
// InsertPkAddressMappings inserts the btc public key and
Expand Down
1 change: 1 addition & 0 deletions internal/shared/http/clients/ordinals/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/babylonlabs-io/staking-api-service/internal/shared/types"
)

//go:generate mockery --name=OrdinalsClient --output=../../../../../tests/mocks --outpkg=mocks --filename=mock_ordinal_client.go
type OrdinalsClient interface {
GetBaseURL() string
GetDefaultRequestTimeout() int
Expand Down
1 change: 1 addition & 0 deletions internal/v1/db/client/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
v1dbmodel "github.com/babylonlabs-io/staking-api-service/internal/v1/db/model"
)

//go:generate mockery --name=V1DBClient --output=../../../../tests/mocks --outpkg=mocks --filename=mock_v1_db_client.go
type V1DBClient interface {
dbclient.DBClient
SaveActiveStakingDelegation(
Expand Down
1 change: 1 addition & 0 deletions internal/v2/db/client/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
v2dbmodel "github.com/babylonlabs-io/staking-api-service/internal/v2/db/model"
)

//go:generate mockery --name=V2DBClient --output=../../../../tests/mocks --outpkg=mocks --filename=mock_v2_db_client.go
type V2DBClient interface {
dbclient.DBClient
GetOverallStats(ctx context.Context) (*v2dbmodel.V2OverallStatsDocument, error)
Expand Down
Loading