From 151db331d992e5382bf1d0f228a7a554ff65f4e6 Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Mon, 30 Oct 2023 09:33:54 -0600 Subject: [PATCH] feat: add mockgen file --- scripts/mockgen.sh | 12 +++ .../{test_utils => testutil}/cowsay.wasm | Bin .../{test_utils => testutil}/hello-world.wasm | Bin .../{test_utils => testutil}/oversized.wasm | Bin .../testutil/expected_keepers_mock.go | 91 ++++++++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 scripts/mockgen.sh rename x/wasm-storage/keeper/{test_utils => testutil}/cowsay.wasm (100%) rename x/wasm-storage/keeper/{test_utils => testutil}/hello-world.wasm (100%) rename x/wasm-storage/keeper/{test_utils => testutil}/oversized.wasm (100%) create mode 100644 x/wasm-storage/testutil/expected_keepers_mock.go diff --git a/scripts/mockgen.sh b/scripts/mockgen.sh new file mode 100644 index 00000000..1421ac8f --- /dev/null +++ b/scripts/mockgen.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +mockgen_cmd="mockgen" + +if ! [ -x "$(command -v $mockgen_cmd)" ]; then + echo "Error: $mockgen_cmd is not installed." >&2 + exit 1 +fi + +# Generate mocks for the given package +$mockgen_cmd -source=x/wasm-storage/types/expected_keepers.go -package testutil -destination x/wasm-storage/testutil/expected_keepers_mock.go + diff --git a/x/wasm-storage/keeper/test_utils/cowsay.wasm b/x/wasm-storage/keeper/testutil/cowsay.wasm similarity index 100% rename from x/wasm-storage/keeper/test_utils/cowsay.wasm rename to x/wasm-storage/keeper/testutil/cowsay.wasm diff --git a/x/wasm-storage/keeper/test_utils/hello-world.wasm b/x/wasm-storage/keeper/testutil/hello-world.wasm similarity index 100% rename from x/wasm-storage/keeper/test_utils/hello-world.wasm rename to x/wasm-storage/keeper/testutil/hello-world.wasm diff --git a/x/wasm-storage/keeper/test_utils/oversized.wasm b/x/wasm-storage/keeper/testutil/oversized.wasm similarity index 100% rename from x/wasm-storage/keeper/test_utils/oversized.wasm rename to x/wasm-storage/keeper/testutil/oversized.wasm diff --git a/x/wasm-storage/testutil/expected_keepers_mock.go b/x/wasm-storage/testutil/expected_keepers_mock.go new file mode 100644 index 00000000..9811fdb0 --- /dev/null +++ b/x/wasm-storage/testutil/expected_keepers_mock.go @@ -0,0 +1,91 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/wasm-storage/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/wasm-storage/types/expected_keepers.go -package testutil -destination x/wasm-storage/testutil/expected_keepers_mock.go +// +// Package testutil is a generated GoMock package. +package testutil + +import ( + reflect "reflect" + + types "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/x/auth/types" + gomock "go.uber.org/mock/gomock" +) + +// MockAccountKeeper is a mock of AccountKeeper interface. +type MockAccountKeeper struct { + ctrl *gomock.Controller + recorder *MockAccountKeeperMockRecorder +} + +// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. +type MockAccountKeeperMockRecorder struct { + mock *MockAccountKeeper +} + +// NewMockAccountKeeper creates a new mock instance. +func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { + mock := &MockAccountKeeper{ctrl: ctrl} + mock.recorder = &MockAccountKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { + return m.recorder +} + +// GetAccount mocks base method. +func (m *MockAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) types0.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccount", ctx, addr) + ret0, _ := ret[0].(types0.AccountI) + return ret0 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) +} + +// MockBankKeeper is a mock of BankKeeper interface. +type MockBankKeeper struct { + ctrl *gomock.Controller + recorder *MockBankKeeperMockRecorder +} + +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. +type MockBankKeeperMockRecorder struct { + mock *MockBankKeeper +} + +// NewMockBankKeeper creates a new mock instance. +func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { + mock := &MockBankKeeper{ctrl: ctrl} + mock.recorder = &MockBankKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { + return m.recorder +} + +// SpendableCoins mocks base method. +func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr) + ret0, _ := ret[0].(types.Coins) + return ret0 +} + +// SpendableCoins indicates an expected call of SpendableCoins. +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) +}