mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
Lint
This commit is contained in:
parent
375296e68d
commit
b3120da26f
@ -666,27 +666,27 @@ describe('Sync protocol', function () {
|
||||
describe('Events - error listener', () => {
|
||||
let sync1, sync2
|
||||
let log1, log2
|
||||
|
||||
|
||||
const timeoutTime = 1 // 1 millisecond
|
||||
const unhandledErrors = []
|
||||
const handleError = (err) => {
|
||||
unhandledErrors.push(err)
|
||||
}
|
||||
|
||||
|
||||
before(async () => {
|
||||
[ipfs1, ipfs2] = await Promise.all([createHelia(), createHelia()])
|
||||
|
||||
|
||||
peerId1 = ipfs1.libp2p.peerId
|
||||
peerId2 = ipfs2.libp2p.peerId
|
||||
|
||||
|
||||
await connectPeers(ipfs1, ipfs2)
|
||||
|
||||
|
||||
log1 = await Log(testIdentity1, { logId: 'synclog6' })
|
||||
log2 = await Log(testIdentity2, { logId: 'synclog6' })
|
||||
|
||||
|
||||
process.on('unhandledRejection', handleError)
|
||||
})
|
||||
|
||||
|
||||
after(async () => {
|
||||
if (sync1) {
|
||||
await sync1.stop()
|
||||
@ -700,24 +700,24 @@ describe('Sync protocol', function () {
|
||||
if (log2) {
|
||||
await log2.close()
|
||||
}
|
||||
|
||||
|
||||
await ipfs1.stop()
|
||||
await ipfs2.stop()
|
||||
|
||||
|
||||
if (typeof process !== 'undefined') { process.off('unhandledRejection', handleError) }
|
||||
})
|
||||
|
||||
|
||||
it('does not crash when no listeners are attached to the `error` event on `Sync.events`', async () => {
|
||||
sync1 = await Sync({ ipfs: ipfs1, log: log1, timeout: timeoutTime })
|
||||
sync2 = await Sync({ ipfs: ipfs2, log: log2, start: false, timeout: timeoutTime })
|
||||
|
||||
|
||||
await log1.append('hello1')
|
||||
|
||||
|
||||
await sync2.start()
|
||||
|
||||
|
||||
// Be sure to wait long enough for the timeout to cancel the operation with an error
|
||||
await new Promise(resolve => setTimeout(resolve, timeoutTime + 10))
|
||||
|
||||
|
||||
// Test that no unhandled abort error has been thrown
|
||||
const err = unhandledErrors.find(e => e.code === 'ABORT_ERR')
|
||||
strictEqual(err, undefined)
|
||||
|
Loading…
x
Reference in New Issue
Block a user