peers separate
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc
2024-05-28 16:47:04 +02:00
parent c1883f1524
commit e674a0cb33
11 changed files with 164 additions and 79 deletions

View File

@ -4,6 +4,7 @@ import (
"strconv"
"testing"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
)
@ -15,9 +16,13 @@ func TestGetFromPublicKey(t *testing.T) {
id.Save()
for i := 1; i < 10; i++ {
var p Peer
p.Uid = uuid.New().String()
p.Name = "test" + strconv.Itoa(i)
p.ContactPublicKey = "stringToFind" + strconv.Itoa(i)
id.Peers = append(id.Peers, &p)
err := id.Peers.StorePeer(&p)
if err != nil {
t.Fatal("StorePeer failed")
}
}
p5 := id.Peers.GetFromPublicKey("stringToFind5")
assert.Equal(t, p5.Name, "test5")