Skip to content

Commit

Permalink
test extra conditions for ApplyPrefix (#4764)
Browse files Browse the repository at this point in the history
* test extra conditions

* review comment
  • Loading branch information
Carlos Rodriguez authored Sep 27, 2023
1 parent c543ac9 commit 500545b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/core/23-commitment/types/merkle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,12 @@ func TestApplyPrefix(t *testing.T) {
prefixedPath, err := types.ApplyPrefix(prefix, path)
require.NoError(t, err, "valid prefix returns error")
require.Len(t, prefixedPath.GetKeyPath(), 2, "unexpected key path length")

key0, err := prefixedPath.GetKey(0)
require.NoError(t, err, "get key 0 returns error")
require.Equal(t, prefix.KeyPrefix, key0, "key 0 does not match expected value")

key1, err := prefixedPath.GetKey(1)
require.NoError(t, err, "get key 1 returns error")
require.Equal(t, []byte(pathStr), key1, "key 1 does not match expected value")
}

0 comments on commit 500545b

Please sign in to comment.