mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
Add test for https://github.com/orbitdb/orbitdb/pull/1221
This commit is contained in:
parent
3d41ab5d99
commit
ef9ffcd1f4
@ -720,5 +720,29 @@ describe('Sync protocol', function () {
|
||||
strictEqual(err.type, 'aborted')
|
||||
strictEqual(err.message, 'Read aborted')
|
||||
})
|
||||
|
||||
it('does not crash when no listeners are attached to the `error` event on `Sync.events`', async () => {
|
||||
let err = null
|
||||
|
||||
const onError = (error) => {
|
||||
(!err) && (err = error)
|
||||
}
|
||||
|
||||
sync1 = await Sync({ ipfs: ipfs1, log: log1, timeout: timeoutTime })
|
||||
sync2 = await Sync({ ipfs: ipfs2, log: log2, start: false, timeout: timeoutTime })
|
||||
|
||||
// `sync1.events` has no listener on `error`
|
||||
sync2.events.on('error', onError)
|
||||
|
||||
await log1.append('hello1')
|
||||
|
||||
await sync2.start()
|
||||
|
||||
await waitFor(() => err !== null, () => true)
|
||||
|
||||
notStrictEqual(err, null)
|
||||
strictEqual(err.type, 'aborted')
|
||||
strictEqual(err.message, 'Read aborted')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user