Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyaoy committed Aug 9, 2024
1 parent d35f8a9 commit d51c012
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions protocol/x/prices/keeper/market_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func TestCreateMarket(t *testing.T) {
mmMarket, _ := marketMapKeeper.GetMarket(ctx, currencyPair.String())
require.False(t, mmMarket.Ticker.Enabled)

// Verify that currency pair is not in the CurrencyPairToID cache
_, found := keeper.GetIDForCurrencyPair(ctx, currencyPair)
require.False(t, found)

marketParam, err := keeper.CreateMarket(
ctx,
testMarketParams,
Expand All @@ -74,6 +78,11 @@ func TestCreateMarket(t *testing.T) {
require.Equal(t, uint32(2), marketParam.MinExchanges)
require.Equal(t, uint32(9999), marketParam.MinPriceChangePpm)

// Verify that currency pair is in the CurrencyPairToID cache
cpID, found := keeper.GetIDForCurrencyPair(ctx, currencyPair)
require.True(t, found)
require.Equal(t, uint64(marketParam.Id), cpID)

// Verify expected price of 0 created.
require.Equal(t, uint32(0), marketPrice.Id)
require.Equal(t, int32(-6), marketPrice.Exponent)
Expand Down

0 comments on commit d51c012

Please sign in to comment.