From b1bbcd6c4629923c7b518ef4b827c08bd9b12d2b Mon Sep 17 00:00:00 2001 From: Sepehr Safari Date: Sat, 20 Jan 2024 09:57:25 +0330 Subject: [PATCH] use mock relay in nip42 tests --- nip42.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nip42.test.ts b/nip42.test.ts index c415662..270fd79 100644 --- a/nip42.test.ts +++ b/nip42.test.ts @@ -1,14 +1,16 @@ -import { test, expect } from 'bun:test' +import { expect, test } from 'bun:test' import { makeAuthEvent } from './nip42.ts' import { Relay } from './relay.ts' +import { newMockRelay } from './test-helpers.ts' test('auth flow', async () => { - const relay = await Relay.connect('wss://nostr.wine') - + const { url } = newMockRelay() + const relay = await Relay.connect(url) const auth = makeAuthEvent(relay.url, 'chachacha') + expect(auth.tags).toHaveLength(2) - expect(auth.tags[0]).toEqual(['relay', 'wss://nostr.wine/']) + expect(auth.tags[0]).toEqual(['relay', url]) expect(auth.tags[1]).toEqual(['challenge', 'chachacha']) expect(auth.kind).toEqual(22242) })