mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-10-07 22:57:07 +00:00
Fix timeout and timing bug in Sync
This commit is contained in:
@@ -319,12 +319,12 @@ describe('KeyValueIndexed Database Replication', function () {
|
||||
])
|
||||
})
|
||||
|
||||
it('indexes deletes correctly', async () => {
|
||||
it.only('indexes deletes correctly', async () => {
|
||||
let replicated = false
|
||||
let err
|
||||
|
||||
const onError = (err) => {
|
||||
console.error(err)
|
||||
deepStrictEqual(err, undefined)
|
||||
const onError = (error) => {
|
||||
err = error
|
||||
}
|
||||
|
||||
kv1 = await KeyValueIndexed()({ ipfs: ipfs1, identity: testIdentity1, address: databaseId, accessController, directory: './orbitdb11' })
|
||||
@@ -339,11 +339,11 @@ describe('KeyValueIndexed Database Replication', function () {
|
||||
|
||||
kv2 = await KeyValueIndexed()({ ipfs: ipfs2, identity: testIdentity2, address: databaseId, accessController, directory: './orbitdb22' })
|
||||
|
||||
const onUpdate = (entry) => {
|
||||
const onConnected = (entry) => {
|
||||
replicated = true
|
||||
}
|
||||
|
||||
kv2.events.on('update', onUpdate)
|
||||
kv2.events.on('join', onConnected)
|
||||
kv2.events.on('error', onError)
|
||||
|
||||
await waitFor(() => replicated, () => true)
|
||||
@@ -358,6 +358,8 @@ describe('KeyValueIndexed Database Replication', function () {
|
||||
all2.push(keyValue)
|
||||
}
|
||||
|
||||
deepStrictEqual(err, undefined)
|
||||
|
||||
deepStrictEqual(all2.map(e => { return { key: e.key, value: e.value } }), [
|
||||
{ key: 'init', value: true },
|
||||
{ key: 'hello', value: 'friend' }
|
||||
|
||||
Reference in New Issue
Block a user