From c3f0f49ff7a541cc4a3b39990f735c71d3ae7b5a Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Tue, 26 Sep 2023 13:57:03 +0200 Subject: [PATCH 1/2] test extra conditions --- 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..83fcb22a511 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, key0, prefix.KeyPrefix, "key 0 does not match expected value") + + key1, err := prefixedPath.GetKey(1) + require.NoError(t, err, "get key 1 returns error") + require.Equal(t, key1, []byte(pathStr), "key 1 does not match expected value") } From 35c28f40a5b16922a0f68a1b1871b74fd8dfc8a7 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Wed, 27 Sep 2023 15:09:53 +0200 Subject: [PATCH 2/2] review comment --- modules/core/23-commitment/types/merkle_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/23-commitment/types/merkle_test.go b/modules/core/23-commitment/types/merkle_test.go index 83fcb22a511..17181358743 100644 --- a/modules/core/23-commitment/types/merkle_test.go +++ b/modules/core/23-commitment/types/merkle_test.go @@ -154,9 +154,9 @@ func TestApplyPrefix(t *testing.T) { key0, err := prefixedPath.GetKey(0) require.NoError(t, err, "get key 0 returns error") - require.Equal(t, key0, prefix.KeyPrefix, "key 0 does not match expected value") + 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, key1, []byte(pathStr), "key 1 does not match expected value") + require.Equal(t, []byte(pathStr), key1, "key 1 does not match expected value") }