Remove obsolete timeout, fix couple of typos in tests

This commit is contained in:
haad 2023-12-15 10:27:02 +02:00
parent 0638fc675b
commit 0fd5287c8c
3 changed files with 6 additions and 17 deletions

View File

@ -50,7 +50,7 @@ describe('OrbitDB', function () {
it('has the IPFS instance given as a parameter', async () => {
const { id: expectedId } = ipfs1.libp2p.peerId
const { id: resultId } = ipfs1.libp2p.peerId
const { id: resultId } = orbitdb1.ipfs.libp2p.peerId
strictEqual(expectedId, resultId)
})

View File

@ -62,7 +62,7 @@ describe('Sync protocol', function () {
await sync.stop()
}
if (log) {
await log.close
await log.close()
}
})

View File

@ -14,29 +14,18 @@ const connectIpfsNodes = async (ipfs1, ipfs2, options = {
await ipfs1.libp2p.dial(multiaddr(`/ip4/127.0.0.1/tcp/12345/ws/p2p/${relayId}`))
let a1
let address1
await waitFor(() => {
a1 = ipfs1.libp2p.getMultiaddrs().filter(ma => WebRTC.matches(ma)).pop()
if (a1 != null) {
return true
} else {
return false
}
address1 = ipfs1.libp2p.getMultiaddrs().filter(ma => WebRTC.matches(ma)).pop()
return address1 != null
}, () => true)
await ipfs2.libp2p.dial(a1)
await ipfs2.libp2p.dial(address1)
} else {
await ipfs2.libp2p.peerStore.save(ipfs1.libp2p.peerId, { multiaddrs: ipfs1.libp2p.getMultiaddrs().filter(options.filter) })
await ipfs2.libp2p.dial(ipfs1.libp2p.peerId)
}
return new Promise((resolve) => {
setTimeout(() => {
resolve()
}, 1000)
})
}
export default connectIpfsNodes