From afcfd8a6fa3f74f5faa5d80bb64144cb6c65caf4 Mon Sep 17 00:00:00 2001 From: amirvalhalla Date: Mon, 3 Jul 2023 23:57:21 +0330 Subject: [PATCH] test: add test for UpdateLastSent to peerset_test --- sync/peerset/peer_set_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sync/peerset/peer_set_test.go b/sync/peerset/peer_set_test.go index 6578805a8..43125f2b5 100644 --- a/sync/peerset/peer_set_test.go +++ b/sync/peerset/peer_set_test.go @@ -94,6 +94,14 @@ func TestPeerSet(t *testing.T) { assert.Equal(t, peer1.Status, StatusCodeBanned) }) + t.Run("Testing UpdateLastSent", func(t *testing.T) { + now := time.Now() + peerSet.UpdateLastSent(pid1) + + peer1 := peerSet.getPeer(pid1) + assert.GreaterOrEqual(t, peer1.LastSent, now) + }) + t.Run("Testing UpdateLastReceived", func(t *testing.T) { now := time.Now() peerSet.UpdateLastReceived(pid1)