How to use the orbit-db-test-utils.connectPeers function in orbit-db-test-utils

To help you get started, we’ve selected a few orbit-db-test-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github orbitdb / ipfs-log / test / replicate.spec.js View on Github external
before(async () => {
      rmrf.sync(ipfsConfig1.repo)
      rmrf.sync(ipfsConfig2.repo)

      rmrf.sync(identityKeysPath)
      rmrf.sync(signingKeysPath)
      await fs.copy(identityKeyFixtures, identityKeysPath)
      await fs.copy(signingKeyFixtures, signingKeysPath)

      // Start two IPFS instances
      ipfs1 = await startIpfs(IPFS, ipfsConfig1)
      ipfs2 = await startIpfs(IPFS, ipfsConfig2)

      await connectPeers(ipfs1, ipfs2)

      // Get the peer IDs
      id1 = await getIpfsPeerId(ipfs1)
      id2 = await getIpfsPeerId(ipfs2)

      // Use mem-store for faster testing (no disk IO)
      const memstore = new MemStore()
      ipfs1.dag.put = memstore.put.bind(memstore)
      ipfs1.dag.get = memstore.get.bind(memstore)
      ipfs2.dag.put = memstore.put.bind(memstore)
      ipfs2.dag.get = memstore.get.bind(memstore)

      keystore = new Keystore(identityKeysPath)
      signingKeystore = new Keystore(signingKeysPath)

      // Create an identity for each peers