Skip to content

Commit

Permalink
abci test
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Sep 18, 2023
1 parent a923f7d commit bf8ce78
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions x/oracle/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/staking/teststaking"
Expand Down Expand Up @@ -177,8 +176,8 @@ func (s *IntegrationTestSuite) TestEndBlockerVoteThreshold() {

for _, denom := range app.OracleKeeper.AcceptList(ctx) {
rate, err := app.OracleKeeper.GetExchangeRate(ctx, denom.SymbolDenom)
s.Require().ErrorIs(err, sdkerrors.Wrap(types.ErrUnknownDenom, denom.SymbolDenom))
s.Require().Equal(sdk.ZeroDec(), rate)
s.Require().ErrorIs(err, types.ErrUnknownDenom.Wrap(denom.SymbolDenom))
s.Require().Equal(types.ExchangeRate{}, rate)
}

// Test: val2 and val3 votes.
Expand All @@ -200,7 +199,7 @@ func (s *IntegrationTestSuite) TestEndBlockerVoteThreshold() {
for _, denom := range app.OracleKeeper.AcceptList(ctx) {
rate, err := app.OracleKeeper.GetExchangeRate(ctx, denom.SymbolDenom)
s.Require().NoError(err)
s.Require().Equal(sdk.MustNewDecFromStr("0.5"), rate)
s.Require().Equal(types.ExchangeRate{Rate: sdk.NewDecWithPrec(5, 1), Timestamp: ctx.BlockTime()}, rate)
}

// TODO: check reward distribution
Expand Down Expand Up @@ -237,10 +236,10 @@ func (s *IntegrationTestSuite) TestEndBlockerVoteThreshold() {

rate, err := app.OracleKeeper.GetExchangeRate(ctx, "umee")
s.Require().NoError(err)
s.Require().Equal(sdk.MustNewDecFromStr("1.0"), rate)
s.Require().Equal(types.ExchangeRate{Rate: sdk.OneDec(), Timestamp: ctx.BlockTime()}, rate)
rate, err = app.OracleKeeper.GetExchangeRate(ctx, "atom")
s.Require().ErrorIs(err, sdkerrors.Wrap(types.ErrUnknownDenom, "atom"))
s.Require().Equal(sdk.ZeroDec(), rate)
s.Require().ErrorIs(err, types.ErrUnknownDenom.Wrap("atom"))
s.Require().Equal(types.ExchangeRate{}, rate)
}

var exchangeRates = map[string][]sdk.Dec{
Expand Down

0 comments on commit bf8ce78

Please sign in to comment.