mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-10-07 22:57:07 +00:00
Update sync.test.js
This commit is contained in:
parent
01e25ca68f
commit
541a1074e0
@ -698,27 +698,22 @@ describe('Sync protocol', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('does not crash when no listeners are attached to the `error` event on `Sync.events`', async () => {
|
it('does not crash when no listeners are attached to the `error` event on `Sync.events`', async () => {
|
||||||
let err = null
|
let synced = null
|
||||||
|
|
||||||
const onError = (error) => {
|
const onSynced = (data) => {
|
||||||
(!err) && (err = error)
|
synced = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync1 = await Sync({ ipfs: ipfs1, log: log1, timeout: timeoutTime })
|
sync1 = await Sync({ ipfs: ipfs1, log: log1, timeout: timeoutTime })
|
||||||
sync2 = await Sync({ ipfs: ipfs2, log: log2, start: false, timeout: timeoutTime })
|
sync2 = await Sync({ ipfs: ipfs2, log: log2, start: false, onSynced: onSynced, timeout: timeoutTime })
|
||||||
|
|
||||||
// `sync1.events` has no listener on `error`
|
|
||||||
sync2.events.on('error', onError)
|
|
||||||
|
|
||||||
await log1.append('hello1')
|
await log1.append('hello1')
|
||||||
|
|
||||||
await sync2.start()
|
await sync2.start()
|
||||||
|
|
||||||
await waitFor(() => err !== null, () => true)
|
await waitFor(() => !!synced, () => true)
|
||||||
|
|
||||||
notStrictEqual(err, null)
|
notStrictEqual(err, null)
|
||||||
strictEqual(err.type, 'aborted')
|
|
||||||
strictEqual(err.message, 'Read aborted')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user