update nip42.test.ts with new mock relay class
This commit is contained in:
parent
0357e035f4
commit
fbcfccda01
|
@ -2,15 +2,15 @@ import { expect, test } from 'bun:test'
|
||||||
|
|
||||||
import { makeAuthEvent } from './nip42.ts'
|
import { makeAuthEvent } from './nip42.ts'
|
||||||
import { Relay } from './relay.ts'
|
import { Relay } from './relay.ts'
|
||||||
import { newMockRelay } from './test-helpers.ts'
|
import { MockRelay } from './test-helpers.ts'
|
||||||
|
|
||||||
test('auth flow', async () => {
|
test('auth flow', async () => {
|
||||||
const { url } = newMockRelay()
|
const mockRelay = new MockRelay()
|
||||||
const relay = await Relay.connect(url)
|
const relay = await Relay.connect(mockRelay.getUrl())
|
||||||
const auth = makeAuthEvent(relay.url, 'chachacha')
|
const auth = makeAuthEvent(relay.url, 'chachacha')
|
||||||
|
|
||||||
expect(auth.tags).toHaveLength(2)
|
expect(auth.tags).toHaveLength(2)
|
||||||
expect(auth.tags[0]).toEqual(['relay', url])
|
expect(auth.tags[0]).toEqual(['relay', mockRelay.getUrl()])
|
||||||
expect(auth.tags[1]).toEqual(['challenge', 'chachacha'])
|
expect(auth.tags[1]).toEqual(['challenge', 'chachacha'])
|
||||||
expect(auth.kind).toEqual(22242)
|
expect(auth.kind).toEqual(22242)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue