From 5caafcef58a7cd2ea8e316d5c1ce67cfe1e15353 Mon Sep 17 00:00:00 2001 From: MariusC Date: Mon, 28 Oct 2024 14:54:14 +0200 Subject: [PATCH] FIX: Unit tests --- .../track/sovereignChainBlockProcessor_test.go | 18 +++++++++--------- .../sovereignChainShardBlockTrack_test.go | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/process/track/sovereignChainBlockProcessor_test.go b/process/track/sovereignChainBlockProcessor_test.go index 134ce42fda0..cfea5069ee9 100644 --- a/process/track/sovereignChainBlockProcessor_test.go +++ b/process/track/sovereignChainBlockProcessor_test.go @@ -378,15 +378,15 @@ func TestSovereignChainBlockProcessor_RequestHeadersShouldAddAndRequestForExtend }) mutRequest.Unlock() - require.Equal(t, 2, len(shardIDAddCalled)) - require.Equal(t, 2, len(nonceAddCalled)) - require.Equal(t, 2, len(shardIDRequestCalled)) - require.Equal(t, 2, len(nonceRequestCalled)) - - assert.Equal(t, []uint32{shardID, shardID}, shardIDAddCalled) - assert.Equal(t, []uint64{fromNonce, fromNonce + 1}, nonceAddCalled) - assert.Equal(t, []uint32{shardID, shardID}, shardIDRequestCalled) - assert.Equal(t, []uint64{fromNonce, fromNonce + 1}, nonceRequestCalled) + require.Equal(t, 1, len(shardIDAddCalled)) + require.Equal(t, 1, len(nonceAddCalled)) + require.Equal(t, 1, len(shardIDRequestCalled)) + require.Equal(t, 1, len(nonceRequestCalled)) + + assert.Equal(t, []uint32{shardID}, shardIDAddCalled) + assert.Equal(t, []uint64{fromNonce}, nonceAddCalled) + assert.Equal(t, []uint32{shardID}, shardIDRequestCalled) + assert.Equal(t, []uint64{fromNonce}, nonceRequestCalled) } func TestSovereignChainShardBlockTrack_getBlockFinality(t *testing.T) { diff --git a/process/track/sovereignChainShardBlockTrack_test.go b/process/track/sovereignChainShardBlockTrack_test.go index a3abae8ef24..9b4d3617748 100644 --- a/process/track/sovereignChainShardBlockTrack_test.go +++ b/process/track/sovereignChainShardBlockTrack_test.go @@ -563,9 +563,10 @@ func TestSovereignChainShardBlockTrack_ComputeLongestExtendedShardChainFromLastN headers, _, _ := scsbt.ComputeLongestExtendedShardChainFromLastNotarized() - require.Equal(t, 2, len(headers)) + require.Equal(t, 3, len(headers)) assert.Equal(t, shardHeaderExtended1, headers[0]) assert.Equal(t, shardHeaderExtended2, headers[1]) + assert.Equal(t, shardHeaderExtended3, headers[2]) }) }