final adjustments and now even the flaky tests that depend on others's relay should pass most of the time.

This commit is contained in:
fiatjaf
2023-12-19 10:01:52 -03:00
parent 804403f574
commit 8840c4d8e2
5 changed files with 21 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
import { test, expect } from 'bun:test'
import { test, expect, afterAll } from 'bun:test'
import { finishEvent, type Event } from './event.ts'
import { generatePrivateKey, getPublicKey } from './keys.ts'
@@ -8,6 +8,10 @@ let pool = new SimplePool()
let relays = ['wss://relay.damus.io/', 'wss://relay.nostr.bg/', 'wss://nos.lol', 'wss://public.relaying.io']
afterAll(() => {
pool.close([...relays, 'wss://offchain.pub', 'wss://eden.nostr.land'])
})
test('removing duplicates when querying', async () => {
let priv = generatePrivateKey()
let pub = getPublicKey(priv)
@@ -33,7 +37,6 @@ test('removing duplicates when querying', async () => {
)
await Promise.any(pool.publish(relays, event))
await new Promise(resolve => setTimeout(resolve, 1500))
expect(received).toHaveLength(1)