Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
GNaD13 committed Jul 16, 2024
1 parent 375fbcf commit 88d4e62
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions x/asset/keeper/token_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package keeper_test

import (
"github.com/realiotech/realio-network/x/asset/types"
)

func (suite *KeeperTestSuite) TestSetToken() {
suite.SetupTest()

token := types.Token{
Name: "token",
Symbol: "Test",
Decimal: "1",
Description: "Test",
}

suite.app.AssetKeeper.SetToken(suite.ctx, "tokenId", token)

expectedToken, found := suite.app.AssetKeeper.GetToken(suite.ctx, "tokenId")

suite.Require().True(found)
suite.Require().Equal(token, expectedToken)
}

func (suite *KeeperTestSuite) TestSetTokenManagement() {
suite.SetupTest()

tokenManagement := types.TokenManagement{
Manager: suite.testUser1Address,
AddNewPrivilege: true,
ExcludedPrivileges: []string{},
}

suite.app.AssetKeeper.SetTokenManagement(suite.ctx, "tokenId", tokenManagement)

expectedTokenManagement, found := suite.app.AssetKeeper.GetTokenManagement(suite.ctx, "tokenId")

suite.Require().True(found)
suite.Require().Equal(tokenManagement, expectedTokenManagement)
}

func (suite *KeeperTestSuite) TestSetTokenPrivilegedAccount() {
suite.SetupTest()

suite.app.AssetKeeper.SetTokenPrivilegedAccount(suite.ctx, "tokenId", "mint", suite.testUser1Acc)

privilegeAccount, found := suite.app.AssetKeeper.GetTokenPrivilegedAccount(suite.ctx, "tokenId", "mint")

suite.Require().True(found)
suite.Require().Equal(suite.testUser1Acc, privilegeAccount)
}

0 comments on commit 88d4e62

Please sign in to comment.