one more nip19 test.
This commit is contained in:
parent
96a6f7af87
commit
649af36a86
|
@ -48,6 +48,7 @@ test('encode and decode naddr', () => {
|
|||
identifier: 'banana'
|
||||
})
|
||||
expect(naddr).toMatch(/naddr1\w+/)
|
||||
console.log(naddr)
|
||||
let {type, data} = nip19.decode(naddr)
|
||||
expect(type).toEqual('naddr')
|
||||
expect(data.pubkey).toEqual(pk)
|
||||
|
@ -57,7 +58,7 @@ test('encode and decode naddr', () => {
|
|||
expect(data.identifier).toEqual('banana')
|
||||
})
|
||||
|
||||
test('encode and decode naddr from habla.news', () => {
|
||||
test('decode naddr from habla.news', () => {
|
||||
let {type, data} = nip19.decode(
|
||||
'naddr1qq98yetxv4ex2mnrv4esygrl54h466tz4v0re4pyuavvxqptsejl0vxcmnhfl60z3rth2xkpjspsgqqqw4rsf34vl5'
|
||||
)
|
||||
|
@ -68,3 +69,20 @@ test('encode and decode naddr from habla.news', () => {
|
|||
expect(data.kind).toEqual(30023)
|
||||
expect(data.identifier).toEqual('references')
|
||||
})
|
||||
|
||||
test('decode naddr from go-nostr with different TLV ordering', () => {
|
||||
let {type, data} = nip19.decode(
|
||||
'naddr1qqrxyctwv9hxzq3q80cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsxpqqqp65wqfwwaehxw309aex2mrp0yhxummnw3ezuetcv9khqmr99ekhjer0d4skjm3wv4uxzmtsd3jjucm0d5q3vamnwvaz7tmwdaehgu3wvfskuctwvyhxxmmd0zfmwx'
|
||||
)
|
||||
|
||||
expect(type).toEqual('naddr')
|
||||
expect(data.pubkey).toEqual(
|
||||
'3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d'
|
||||
)
|
||||
expect(data.relays).toContain(
|
||||
'wss://relay.nostr.example.mydomain.example.com'
|
||||
)
|
||||
expect(data.relays).toContain('wss://nostr.banana.com')
|
||||
expect(data.kind).toEqual(30023)
|
||||
expect(data.identifier).toEqual('banana')
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue