fix tests, .seenOn() method for pools.

This commit is contained in:
fiatjaf
2023-02-09 15:10:42 -03:00
parent 5a9cbbb557
commit 9bcaed6e60
5 changed files with 43 additions and 20 deletions

View File

@@ -20,7 +20,12 @@ let relays = [
]
afterAll(async () => {
await pool.close([...relays, 'wss://nostr-relay.untethr.me'])
await pool.close([
...relays,
'wss://nostr-relay.untethr.me',
'wss://offchain.pub',
'wss://eden.nostr.land'
])
})
test('removing duplicates when querying', async () => {
@@ -120,4 +125,9 @@ test('list()', async () => {
.reduce((acc, n) => (acc.indexOf(n) !== -1 ? acc : [...acc, n]), [])
.length
)
let relaysForAllEvents = events
.map(event => pool.seenOn(event.id))
.reduce((acc, n) => acc.concat(n), [])
expect(relaysForAllEvents.length).toBeGreaterThanOrEqual(events.length)
})