This commit is contained in:
parent
0f8bdf5f66
commit
d9155bac51
@ -1,10 +1,21 @@
|
|||||||
package client
|
package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetFromPublicKey(t *testing.T) {
|
func TestGetFromPublicKey(t *testing.T) {
|
||||||
id := CreateIdentity("test")
|
id := CreateIdentity("test")
|
||||||
id.Save()
|
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")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user