Skip to content

Commit

Permalink
Init EndBlocker Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joelsmith-2019 committed Nov 28, 2023
1 parent b301d75 commit 5d737ca
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
4 changes: 1 addition & 3 deletions x/clock/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import (
"github.com/CosmosContracts/juno/v18/x/clock/types"
)

var (
endBlockSudoMessage = []byte(types.EndBlockSudoMessage)
)
var endBlockSudoMessage = []byte(types.EndBlockSudoMessage)

// EndBlocker executes on contracts at the end of the block.
func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
Expand Down
41 changes: 41 additions & 0 deletions x/clock/abci_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package clock_test

import (
"testing"

"github.com/stretchr/testify/suite"

tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/CosmosContracts/juno/v18/app"
clock "github.com/CosmosContracts/juno/v18/x/clock"
)

type EndBlockerTestSuite struct {
suite.Suite

ctx sdk.Context

app *app.App
}

func TestEndBlockerTestSuite(t *testing.T) {
suite.Run(t, new(EndBlockerTestSuite))
}

func (s *EndBlockerTestSuite) SetupTest() {
app := app.Setup(s.T())
ctx := app.BaseApp.NewContext(false, tmproto.Header{
ChainID: "testing",
})

s.app = app
s.ctx = ctx
}

func (s *EndBlockerTestSuite) TestEndBlocker() {
// Call end blocker
clock.EndBlocker(s.ctx, s.app.AppKeepers.ClockKeeper)
}
4 changes: 2 additions & 2 deletions x/clock/keeper/keeper.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package keeper

import (
"github.com/cometbft/cometbft/libs/log"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

"github.com/cometbft/cometbft/libs/log"

"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down

0 comments on commit 5d737ca

Please sign in to comment.