Skip to content

Commit

Permalink
added a test case to migration
Browse files Browse the repository at this point in the history
  • Loading branch information
miladz68 committed Oct 9, 2023
1 parent b9527f1 commit 87e4b2c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions integration-tests/upgrade/nft_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,39 @@ func (nut *nftMigrationTest) After(t *testing.T) {
nfts, err := nftClient.NFTs(ctx, &cosmosnft.QueryNFTsRequest{Owner: nut.issuer.String()})
requireT.NoError(err)
requireT.ElementsMatch(nut.nfts, cnftkeeper.ConvertFromCosmosNFTList(nfts.Nfts))

// try sending the nft minted before the upgrade
recipient := chain.GenAccount()
chain.FundAccountWithOptions(ctx, t, nut.issuer, integration.BalancesOptions{
Messages: []sdk.Msg{
&cosmosnft.MsgSend{},
&cosmosnft.MsgSend{},
},
})

sendMsg := []sdk.Msg{
&cosmosnft.MsgSend{
ClassId: nfts.Nfts[0].ClassId,
Id: nfts.Nfts[0].Id,
Sender: nut.issuer.String(),
Receiver: recipient.String(),
},
&cosmosnft.MsgSend{
ClassId: nfts.Nfts[1].ClassId,
Id: nfts.Nfts[1].Id,
Sender: nut.issuer.String(),
Receiver: recipient.String(),
},
}
_, err = client.BroadcastTx(
ctx,
chain.ClientContext.WithFromAddress(nut.issuer),
chain.TxFactory().WithGas(chain.GasLimitByMsgs(sendMsg...)),
sendMsg...,
)
requireT.NoError(err)

nfts, err = nftClient.NFTs(ctx, &cosmosnft.QueryNFTsRequest{Owner: recipient.String()})
requireT.NoError(err)
requireT.Len(nfts.Nfts, 2)
}

0 comments on commit 87e4b2c

Please sign in to comment.