(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestGetRandom(t *testing.T) { |
| 10 | n1, n2 := newTestP2PNode(t), newTestP2PNode(t) |
| 11 | require.Nil(t, n1.book.GetRandom()) |
| 12 | require.Nil(t, n1.book.GetRandom()) |
| 13 | n1.book.Add(&BookPeer{Address: &lib.PeerAddress{ |
| 14 | PublicKey: n2.pub, |
| 15 | NetAddress: "", |
| 16 | PeerMeta: &lib.PeerMeta{ChainId: 1}, |
| 17 | }}) |
| 18 | got := n1.book.GetRandom() |
| 19 | require.Equal(t, got.Address.PublicKey, n2.pub) |
| 20 | got = n1.book.GetRandom() |
| 21 | require.Equal(t, got.Address.PublicKey, n2.pub) |
| 22 | } |
| 23 | |
| 24 | func TestGetAll(t *testing.T) { |
| 25 | n1, n2, n3 := newTestP2PNode(t), newTestP2PNode(t), newTestP2PNode(t) |
nothing calls this directly
no test coverage detected