Skip to content

Commit

Permalink
[1699]: Unit tests on the CreateAsk and CreateBid endpoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpicyLemon committed Oct 27, 2023
1 parent eedf1b6 commit 58b93d1
Show file tree
Hide file tree
Showing 2 changed files with 648 additions and 4 deletions.
12 changes: 11 additions & 1 deletion x/exchange/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ type TestSuite struct {
marketAddr2 sdk.AccAddress
marketAddr3 sdk.AccAddress

feeCollector string
feeCollector string
feeCollectorAddr sdk.AccAddress

accKeeper *MockAccountKeeper

Expand Down Expand Up @@ -99,6 +100,7 @@ func (s *TestSuite) SetupTest() {
s.marketAddr3 = exchange.GetMarketAddress(3)

s.feeCollector = s.k.GetFeeCollectorName()
s.feeCollectorAddr = authtypes.NewModuleAddress(s.feeCollector)
}

func TestKeeperTestSuite(t *testing.T) {
Expand Down Expand Up @@ -358,6 +360,14 @@ func (s *TestSuite) requireFundAccount(addr sdk.AccAddress, coins string) {
}, "FundAccount(%s, %q)", s.getAddrName(addr), coins)
}

// requireAddHold calls s.app.HoldKeeper.AddHold, making sure it doesn't panic or return an error.
func (s *TestSuite) requireAddHold(addr sdk.AccAddress, holdCoins, reason string) {
coins := s.coins(holdCoins)
assertions.RequireNotPanicsNoErrorf(s.T(), func() error {
return s.app.HoldKeeper.AddHold(s.ctx, addr, coins, reason)
}, "AddHold(%s, %q, %q)", s.getAddrName(addr), holdCoins, reason)
}

// requireSetOrderInStore calls SetOrderInStore making sure it doesn't panic or return an error.
func (s *TestSuite) requireSetOrderInStore(store sdk.KVStore, order *exchange.Order) {
assertions.RequireNotPanicsNoErrorf(s.T(), func() error {
Expand Down
Loading

0 comments on commit 58b93d1

Please sign in to comment.