Skip to content

Commit

Permalink
feat: Migrate keeper tests to ginkgo
Browse files Browse the repository at this point in the history
  • Loading branch information
DaevMithran committed Nov 30, 2022
1 parent 5902c83 commit 67ae6f0
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 588 deletions.
3 changes: 2 additions & 1 deletion ante/fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ var _ = Describe("Fee tests on DeliverTx", func() {
s := new(AnteTestSuite)

BeforeEach(func() {
s.SetupTest(false) // setup
err := s.SetupTest(false) // setup
Expect(err).To(BeNil(), "Error on creating test app")
s.txBuilder = s.clientCtx.TxConfig.NewTxBuilder()
})

Expand Down
15 changes: 11 additions & 4 deletions ante/testutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ type AnteTestSuite struct {
}

// returns context and app with params set on account keeper
func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
app := simapp.SetupForGinkgo(isCheckTx)
func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context, error) {
app, err := simapp.Setup(isCheckTx)
if err != nil {
return nil, sdk.Context{}, err
}
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams())

Expand All @@ -53,7 +56,7 @@ func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
resourceFeeParams := resourcetypes.DefaultGenesis().FeeParams
app.ResourceKeeper.SetParams(ctx, *resourceFeeParams)

return app, ctx
return app, ctx, nil
}

// func TestAnteTestSuite(t *testing.T) {
Expand All @@ -62,7 +65,11 @@ func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {

// SetupTest setups a new test, with new app, context, and anteHandler.
func (s *AnteTestSuite) SetupTest(isCheckTx bool) error {
s.app, s.ctx = createTestApp(isCheckTx)
var err error
s.app, s.ctx, err = createTestApp(isCheckTx)
if err != nil {
return err
}
s.ctx = s.ctx.WithBlockHeight(1)
// Set up TxConfig.
encodingConfig := cheqdapp.MakeTestEncodingConfig()
Expand Down
Loading

0 comments on commit 67ae6f0

Please sign in to comment.