From 013daae91bb986cbbabeb1d988bf3a63b2dad6c4 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 23 Oct 2024 17:09:56 -0300 Subject: [PATCH] nip05: fix test. --- nip05.test.ts | 27 +++++++++++---------------- package.json | 2 +- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/nip05.test.ts b/nip05.test.ts index 2c3f79b..3b7af8c 100644 --- a/nip05.test.ts +++ b/nip05.test.ts @@ -3,22 +3,6 @@ import fetch from 'node-fetch' import { useFetchImplementation, queryProfile, NIP05_REGEX, isNip05 } from './nip05.ts' -test('fetch nip05 profiles', async () => { - useFetchImplementation(fetch) - - let p1 = await queryProfile('jb55.com') - expect(p1!.pubkey).toEqual('32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245') - expect(p1!.relays).toEqual(['wss://relay.damus.io']) - - let p2 = await queryProfile('jb55@jb55.com') - expect(p2!.pubkey).toEqual('32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245') - expect(p2!.relays).toEqual(['wss://relay.damus.io']) - - let p3 = await queryProfile('_@fiatjaf.com') - expect(p3!.pubkey).toEqual('3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d') - expect(p3!.relays).toEqual(['wss://pyramid.fiatjaf.com', 'wss://nos.lol']) -}) - test('validate NIP05_REGEX', () => { expect(NIP05_REGEX.test('_@bob.com.br')).toBeTrue() expect(NIP05_REGEX.test('bob@bob.com.br')).toBeTrue() @@ -30,3 +14,14 @@ test('validate NIP05_REGEX', () => { expect(isNip05('bob@bob.com.br')).toBeTrue() expect(isNip05('b&b@bob.com.br')).toBeFalse() }) + +test('fetch nip05 profiles', async () => { + useFetchImplementation(fetch) + + let p2 = await queryProfile('compile-error.net') + expect(p2!.pubkey).toEqual('2c7cc62a697ea3a7826521f3fd34f0cb273693cbe5e9310f35449f43622a5cdc') + + let p3 = await queryProfile('_@fiatjaf.com') + expect(p3!.pubkey).toEqual('3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d') + expect(p3!.relays).toEqual(['wss://pyramid.fiatjaf.com', 'wss://nos.lol']) +}) diff --git a/package.json b/package.json index 9949c36..4b30dd2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "nostr-tools", - "version": "2.9.0", + "version": "2.9.1", "description": "Tools for making a Nostr client.", "repository": { "type": "git",