From 500545b0dd5a2333fc33221a85b3c96fa918e058 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Wed, 27 Sep 2023 15:45:00 +0200 Subject: [PATCH] test extra conditions for `ApplyPrefix` (#4764) * test extra conditions * review comment --- modules/core/23-commitment/types/merkle_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/core/23-commitment/types/merkle_test.go b/modules/core/23-commitment/types/merkle_test.go index 74ea939abb9..17181358743 100644 --- a/modules/core/23-commitment/types/merkle_test.go +++ b/modules/core/23-commitment/types/merkle_test.go @@ -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") }