Skip to content

Commit

Permalink
feat: feeshare post hanlder tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emidev98 committed Nov 21, 2023
1 parent 56322a9 commit 3ed296d
Show file tree
Hide file tree
Showing 5 changed files with 449 additions and 5 deletions.
13 changes: 9 additions & 4 deletions app/app_test/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ import (
type AppTestSuite struct {
suite.Suite

App *app.TerraApp
Ctx sdk.Context
QueryHelper *baseapp.QueryServiceTestHelper
TestAccs []sdk.AccAddress
App *app.TerraApp
Ctx sdk.Context
QueryHelper *baseapp.QueryServiceTestHelper
TestAccs []sdk.AccAddress
EncodingConfig appparams.EncodingConfig
}

// Setup sets up basic environment for suite (App, Ctx, and test accounts)
Expand All @@ -62,6 +63,7 @@ func (s *AppTestSuite) Setup() {
simtestutil.EmptyAppOptions{},
wasmconfig.DefaultConfig(),
)
s.EncodingConfig = encCfg

s.Ctx = s.App.NewContext(true, tmproto.Header{Height: 1, Time: time.Now()})
s.QueryHelper = &baseapp.QueryServiceTestHelper{
Expand All @@ -80,6 +82,9 @@ func (s *AppTestSuite) Setup() {
err = s.App.Keepers.TokenFactoryKeeper.SetParams(s.Ctx, tokenfactorytypes.DefaultParams())
s.Require().NoError(err)

err = s.FundModule(authtypes.FeeCollectorName, sdk.NewCoins(sdk.NewCoin("uluna", sdk.NewInt(1000)), sdk.NewCoin("utoken", sdk.NewInt(500))))
s.Require().NoError(err)

s.App.Keepers.DistrKeeper.SetFeePool(s.Ctx, distrtypes.InitialFeePool())

s.TestAccs = s.CreateRandomAccounts(3)
Expand Down
92 changes: 92 additions & 0 deletions app/post/mocks/post_mock.go

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

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ require (
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
github.com/terra-money/alliance v0.3.2
go.uber.org/mock v0.3.0
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97
google.golang.org/grpc v1.58.3
)
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,8 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU=
go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo=
go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
Expand Down
Loading

0 comments on commit 3ed296d

Please sign in to comment.