Skip to content

Commit

Permalink
add unit test for EnsureUniqueKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
kiragpg committed Mar 19, 2024
1 parent 3911a08 commit 253c010
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions x/gov/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,25 @@ func TestKeeper_SetNetworkProperty(t *testing.T) {
require.Nil(t, err)
require.Equal(t, uint64(300), savedMinTxFee.Value)
}

func TestKeeper_EnsureUniqueKeys(t *testing.T) {
app := simapp.Setup(false)
ctx := app.NewContext(false, tmproto.Header{})

app.CustomGovKeeper.SetIdentityRecord(ctx, types.IdentityRecord{
Id: 1,
Address: "addr1",
Key: "nickname",
Value: "jack",
})
notUniqueKey := app.CustomGovKeeper.EnsureUniqueKeys(ctx, "", "nickname")
require.Equal(t, notUniqueKey, "")
app.CustomGovKeeper.SetIdentityRecord(ctx, types.IdentityRecord{
Id: 2,
Address: "addr2",
Key: "nickname",
Value: "jack",
})
notUniqueKey = app.CustomGovKeeper.EnsureUniqueKeys(ctx, "", "nickname")
require.Equal(t, notUniqueKey, "nickname")
}

0 comments on commit 253c010

Please sign in to comment.