Skip to content

Commit

Permalink
test: use app constants (celestiaorg#3009)
Browse files Browse the repository at this point in the history
## Overview

Refactor tests to use app constants instead of hardcoded values

## Checklist

- [ ] New and updated code has appropriate documentation
- [ ] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [ ] Visual proof for any user facing features like CLI or
documentation updates
- [ ] Linked issues closed with keywords
  • Loading branch information
ninabarbakadze authored Jan 13, 2024
1 parent b04f2d5 commit 34c98b9
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 6 deletions.
11 changes: 6 additions & 5 deletions app/ante/fee_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ante
import (
"testing"

"github.com/celestiaorg/celestia-app/pkg/appconsts"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
)
Expand All @@ -16,31 +17,31 @@ func TestGetTxPriority(t *testing.T) {
}{
{
name: "1 TIA fee large gas",
fee: sdk.NewCoins(sdk.NewInt64Coin("utia", 1_000_000)),
fee: sdk.NewCoins(sdk.NewInt64Coin(appconsts.BondDenom, 1_000_000)),
gas: 1000000,
expectedPri: 1000000,
},
{
name: "1 utia fee small gas",
fee: sdk.NewCoins(sdk.NewInt64Coin("utia", 1)),
fee: sdk.NewCoins(sdk.NewInt64Coin(appconsts.BondDenom, 1)),
gas: 1,
expectedPri: 1000000,
},
{
name: "2 utia fee small gas",
fee: sdk.NewCoins(sdk.NewInt64Coin("utia", 2)),
fee: sdk.NewCoins(sdk.NewInt64Coin(appconsts.BondDenom, 2)),
gas: 1,
expectedPri: 2000000,
},
{
name: "1_000_000 TIA fee normal gas tx",
fee: sdk.NewCoins(sdk.NewInt64Coin("utia", 1_000_000_000_000)),
fee: sdk.NewCoins(sdk.NewInt64Coin(appconsts.BondDenom, 1_000_000_000_000)),
gas: 75000,
expectedPri: 13333333333333,
},
{
name: "0.001 utia gas price",
fee: sdk.NewCoins(sdk.NewInt64Coin("utia", 1_000)),
fee: sdk.NewCoins(sdk.NewInt64Coin(appconsts.BondDenom, 1_000)),
gas: 1_000_000,
expectedPri: 1000,
},
Expand Down
3 changes: 2 additions & 1 deletion app/ante/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/ante"
"github.com/celestiaorg/celestia-app/app/encoding"
"github.com/celestiaorg/celestia-app/pkg/appconsts"
"github.com/celestiaorg/celestia-app/test/util/testfactory"
"github.com/celestiaorg/celestia-app/test/util/testnode"
"github.com/cosmos/cosmos-sdk/types"
Expand All @@ -18,7 +19,7 @@ func TestGovDecorator(t *testing.T) {
decorator := ante.NewGovProposalDecorator()
anteHandler := types.ChainAnteDecorators(decorator)
accounts := testfactory.GenerateAccounts(1)
coins := types.NewCoins(types.NewCoin("utia", types.NewInt(10)))
coins := types.NewCoins(types.NewCoin(appconsts.BondDenom, types.NewInt(10)))

msgSend := banktypes.NewMsgSend(
testnode.RandomAddress().(types.AccAddress),
Expand Down
Loading

0 comments on commit 34c98b9

Please sign in to comment.