meowlib/client/peer_test.go
ycc a5cfbf854d
Some checks failed
continuous-integration/drone/push Build is failing
add identity folder creation
2024-03-29 18:26:41 +01:00

25 lines
488 B
Go

package client
import (
"strconv"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetFromPublicKey(t *testing.T) {
id, err := CreateIdentity("test")
if err != nil {
t.Fatal("CreateIdentity failed")
}
id.Save()
for i := 1; i < 10; i++ {
var p Peer
p.Name = "test" + strconv.Itoa(i)
p.ContactPublicKey = "stringToFind" + strconv.Itoa(i)
id.Peers = append(id.Peers, &p)
}
p5 := id.Peers.GetFromPublicKey("stringToFind5")
assert.Equal(t, p5.Name, "test5")
}