Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Sep 15, 2023
1 parent c39b114 commit f827c61
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions x/oracle/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ func (s *IntegrationTestSuite) TestAggregateExchangeRateVoteError() {
}

func (s *IntegrationTestSuite) TestSetExchangeRateWithEvent() {
app, ctx := s.app, s.ctx
app.OracleKeeper.SetExchangeRateWithEvent(ctx, displayDenom, sdk.OneDec())
rate, err := app.OracleKeeper.GetExchangeRate(ctx, displayDenom)
v := sdk.OneDec()
s.app.OracleKeeper.SetExchangeRateWithEvent(s.ctx, displayDenom, v)
rate, err := s.app.OracleKeeper.GetExchangeRate(s.ctx, displayDenom)
s.Require().NoError(err)
s.Require().Equal(rate, sdk.OneDec())
s.Require().Equal(rate, types.ExchangeRate{Rate: v, Timestamp: s.ctx.BlockTime()})
}

func (s *IntegrationTestSuite) TestGetExchangeRate_InvalidDenom() {
Expand All @@ -227,17 +227,17 @@ func (s *IntegrationTestSuite) TestGetExchangeRate_NotSet() {
}

func (s *IntegrationTestSuite) TestGetExchangeRate_Valid() {
app, ctx := s.app, s.ctx

app.OracleKeeper.SetExchangeRate(ctx, displayDenom, sdk.OneDec())
rate, err := app.OracleKeeper.GetExchangeRate(ctx, displayDenom)
v := sdk.OneDec()
expected := types.ExchangeRate{Rate: v, Timestamp: s.ctx.BlockTime()}
s.app.OracleKeeper.SetExchangeRate(s.ctx, displayDenom, v)
rate, err := s.app.OracleKeeper.GetExchangeRate(s.ctx, displayDenom)
s.Require().NoError(err)
s.Require().Equal(rate, sdk.OneDec())
s.Require().Equal(rate, expected)

app.OracleKeeper.SetExchangeRate(ctx, strings.ToLower(displayDenom), sdk.OneDec())
rate, err = app.OracleKeeper.GetExchangeRate(ctx, displayDenom)
s.app.OracleKeeper.SetExchangeRate(s.ctx, strings.ToLower(displayDenom), sdk.OneDec())
rate, err = s.app.OracleKeeper.GetExchangeRate(s.ctx, displayDenom)
s.Require().NoError(err)
s.Require().Equal(rate, sdk.OneDec())
s.Require().Equal(rate, expected)
}

func (s *IntegrationTestSuite) TestGetExchangeRateBase() {
Expand Down

0 comments on commit f827c61

Please sign in to comment.