From d9155bac51a1361a7fcd8b72f325ec5b1d12ce4d Mon Sep 17 00:00:00 2001 From: ycc Date: Wed, 11 Jan 2023 22:43:08 +0100 Subject: [PATCH] tests --- client/peer_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/peer_test.go b/client/peer_test.go index 2288d42..5a247d5 100644 --- a/client/peer_test.go +++ b/client/peer_test.go @@ -1,10 +1,21 @@ package client import ( + "strconv" "testing" + + "github.com/stretchr/testify/assert" ) func TestGetFromPublicKey(t *testing.T) { id := CreateIdentity("test") id.Save() + for i := 1; i < 10; i++ { + var p Peer + p.Name = "test" + strconv.Itoa(i) + p.Contact.ContactPublicKey = "stringToFind" + strconv.Itoa(i) + id.Peers = append(id.Peers, p) + } + p5 := id.Peers.GetFromPublicKey("stringToFind5") + assert.Equal(t, p5.Name, "test5") }