From f633ec2f61c2a891f70d4ffa35695c40ca609088 Mon Sep 17 00:00:00 2001 From: "Matt, Park" <45252226+mattverse@users.noreply.github.com> Date: Thu, 7 Dec 2023 16:37:06 +0900 Subject: [PATCH] Add test cases (#7018) --- x/tokenfactory/keeper/before_send_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/x/tokenfactory/keeper/before_send_test.go b/x/tokenfactory/keeper/before_send_test.go index ec3a26844b0..1bc5b9746be 100644 --- a/x/tokenfactory/keeper/before_send_test.go +++ b/x/tokenfactory/keeper/before_send_test.go @@ -120,6 +120,16 @@ func (s *KeeperTestSuite) TestBeforeSendHook() { } else { s.Require().Error(err, "test: %v", sendTc.desc) } + + // this is a check to ensure bank keeper wired in token factory keeper has hooks properly set + // to check this, we try triggering bank hooks via token factory keeper + for _, coin := range sendTc.msg(denom).Amount { + _, err = s.msgServer.Mint(sdk.WrapSDKContext(s.Ctx), types.NewMsgMint(s.TestAccs[0].String(), sdk.NewInt64Coin(coin.Denom, coin.Amount.Int64()))) + if coin.Denom == denom && coin.Amount.Equal(sdk.NewInt(100)) { + s.Require().Error(err, "test: %v", sendTc.desc) + } + } + } }) }