Skip to content

Commit

Permalink
e2e test added
Browse files Browse the repository at this point in the history
  • Loading branch information
kosegor committed Nov 13, 2023
1 parent 65cdfad commit 633a6ec
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/e2e/e2e_metoken_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,34 @@ func (s *E2ETest) TestMetokenSwapAndRedeem() {
s.checkMetokenBalance(testAddr.String(), mocks.MeUSDDenom)
},
)

s.Run(
"add_metoken_to_leverage", func() {
tokens := []ltypes.Token{
mocks.ValidToken(mocks.MeUSDDenom, mocks.MeUSDDenom, 6),
}

err := grpc.LeverageRegistryUpdate(s.AccountClient(0), tokens, nil)
s.Require().NoError(err)
s.checkMetokenPriceInOracle(mocks.MeUSDDenom)
},
)
}

func (s *E2ETest) checkMetokenPriceInOracle(denom string) {
s.Require().Eventually(
func() bool {
exchangeRates, err := s.QueryExchangeRate(s.UmeeREST(), denom)
if err != nil {
return false
}
if exchangeRates.AmountOf(denom).IsZero() {
return false
}
return true
},
2*time.Minute, 12*time.Second, "fetching metoken price",
)
}

func (s *E2ETest) checkMetokenBalance(valAddr, denom string) {
Expand Down

0 comments on commit 633a6ec

Please sign in to comment.