added some missing validations

This commit is contained in:
херетик
2023-05-31 12:53:18 +01:00
parent d7cf030a6d
commit 03305b91e9
3 changed files with 12 additions and 1 deletions

View File

@@ -50,7 +50,6 @@ func TestAdAddress(t *testing.T) {
t.Errorf("address did not decode correctly")
t.FailNow()
}
if !ad.Key.Equals(crypto.DerivePub(pr)) {
t.Errorf("public key did not decode correctly")
t.FailNow()

View File

@@ -53,6 +53,10 @@ func TestOnionSkins_IntroAd(t *testing.T) {
t.Errorf("relay rate did not decode correctly")
t.FailNow()
}
if !intro.Expiry.Equal(in.Expiry) {
t.Errorf("expiry did not decode correctly")
t.FailNow()
}
if intro.AddrPort.String() != in.AddrPort.String() {
t.Errorf("addrport did not decode correctly")
t.FailNow()

View File

@@ -43,6 +43,14 @@ func TestPeerAd(t *testing.T) {
if peer, ok = onc.(*PeerAd); !ok {
t.Fatal("did not unwrap expected type")
}
if peer.ID != pa.ID {
t.Errorf("ID did not decode correctly")
t.FailNow()
}
if !peer.Key.Equals(crypto.DerivePub(pr)) {
t.Errorf("public key did not decode correctly")
t.FailNow()
}
if !peer.Validate() {
t.Fatalf("received PeerAd did not validate")
}