From 0fd5287c8c2b208515e731f0e6940b8ecd3965fc Mon Sep 17 00:00:00 2001 From: haad Date: Fri, 15 Dec 2023 10:27:02 +0200 Subject: [PATCH] Remove obsolete timeout, fix couple of typos in tests --- test/orbitdb.test.js | 2 +- test/sync.test.js | 2 +- test/utils/connect-nodes.js | 19 ++++--------------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/test/orbitdb.test.js b/test/orbitdb.test.js index 05f1f88..d0ab970 100644 --- a/test/orbitdb.test.js +++ b/test/orbitdb.test.js @@ -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) }) diff --git a/test/sync.test.js b/test/sync.test.js index cf26abe..edc7a40 100644 --- a/test/sync.test.js +++ b/test/sync.test.js @@ -62,7 +62,7 @@ describe('Sync protocol', function () { await sync.stop() } if (log) { - await log.close + await log.close() } }) diff --git a/test/utils/connect-nodes.js b/test/utils/connect-nodes.js index 93b0d1f..82eff47 100644 --- a/test/utils/connect-nodes.js +++ b/test/utils/connect-nodes.js @@ -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