mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 21:32:56 +01:00
one more nip19 test.
This commit is contained in:
parent
e4c5dfbebb
commit
4dbbcec80a
@ -1,7 +1,6 @@
|
||||
package nip19
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@ -58,8 +57,6 @@ func TestDecodeNprofile(t *testing.T) {
|
||||
t.Error("value returned of wrong type")
|
||||
}
|
||||
|
||||
fmt.Println(pp)
|
||||
|
||||
if pp.PublicKey != "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d" {
|
||||
t.Error("decoded invalid public key")
|
||||
}
|
||||
@ -72,6 +69,31 @@ func TestDecodeNprofile(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeOtherNprofile(t *testing.T) {
|
||||
prefix, data, err := Decode("nprofile1qqsw3dy8cpumpanud9dwd3xz254y0uu2m739x0x9jf4a9sgzjshaedcpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5qyw8wumn8ghj7mn0wd68yttjv4kxz7fww4h8get5dpezumt9qyvhwumn8ghj7un9d3shjetj9enxjct5dfskvtnrdakstl69hg")
|
||||
if err != nil {
|
||||
t.Error("failed to decode nprofile")
|
||||
}
|
||||
if prefix != "nprofile" {
|
||||
t.Error("what")
|
||||
}
|
||||
pp, ok := data.(ProfilePointer)
|
||||
if !ok {
|
||||
t.Error("value returned of wrong type")
|
||||
}
|
||||
|
||||
if pp.PublicKey != "e8b487c079b0f67c695ae6c4c2552a47f38adfa2533cc5926bd2c102942fdcb7" {
|
||||
t.Error("decoded invalid public key")
|
||||
}
|
||||
|
||||
if len(pp.Relays) != 3 {
|
||||
t.Error("decoded wrong number of relays")
|
||||
}
|
||||
if pp.Relays[0] != "wss://nostr-pub.wellorder.net" || pp.Relays[1] != "wss://nostr-relay.untethr.me" {
|
||||
t.Error("decoded relay URLs wrongly")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncodeNprofile(t *testing.T) {
|
||||
nprofile, err := EncodeProfile("3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d", []string{
|
||||
"wss://r.x.com",
|
||||
|
Loading…
x
Reference in New Issue
Block a user