test decode nip19 with relays.

closes https://github.com/nbd-wtf/nostr-tools/issues/147
This commit is contained in:
fiatjaf 2023-03-02 21:30:20 -03:00
parent 63cbc4133a
commit 01435ab9f5
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
1 changed files with 15 additions and 0 deletions

View File

@ -35,6 +35,21 @@ test('encode and decode nprofile', () => {
expect(data.relays).toContain(relays[1])
})
test('decode nprofile without relays', () => {
expect(
nip19.decode(
nip19.nprofileEncode({
pubkey:
'97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322',
relays: []
})
).data
).toHaveProperty(
'pubkey',
'97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322'
)
})
test('encode and decode naddr', () => {
let pk = getPublicKey(generatePrivateKey())
let relays = [