New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

orbit-db-test-utils

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orbit-db-test-utils

Shared test utilities for OrbitDB-related projects

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
181
88.54%
Maintainers
1
Weekly downloads
 
Created
Source

OrbitDB Test Utils (orbit-db-test-utils)

Shared test utilities for OrbitDB-related projects

Gitter Matrix CircleCI

This repository contains utilities to spin up IPFS nodes and swarms, as well as different abstract-leveldown implementations to use with orbit-db-keystore and orbit-db-cache.

For examples on how this would be used, see the test folder in this repo, or read on!

Install

$ npm install -D orbit-db-test-utils

Usage

Spawn a single IPFS instance

const {
  connectPeers,
  startIpfs,
  stopIpfs,
  getIpfsPeerId,
  waitForPeers
} = require('../')

;(async () => {
  // Create JS and Go nodes
  const ipfsd1 = await startIpfs('js-ipfs')
  const ipfsd2 = await startIpfs('go-ipfs')

  // Get the peer IDs
  const id1 = await getIpfsPeerId(ipfsd1.api)
  const id2 = await getIpfsPeerId(ipfsd2.api)

  // Helper function to connect the nodes
  await connectPeers(ipfsd1.api, ipfsd2.api)

  // Test that the nodes are pubsubbing with each other
  const topic = 'test-topic'
  await ipfsd1.api.pubsub.subscribe(topic, () => {})
  await ipfsd2.api.pubsub.subscribe(topic, () => {})
  await waitForPeers(ipfsd1.api, [id2], topic)

  // stop the nodes
  await stopIpfs(ipfsd1)
  await stopIpfs(ipfsd2)
})()

Note: You may run into issues with stopIpfs hanging the script due to a js-ipfs bug

Contributing

Issues and PRs are welcome.

License

MIT © OrbitDB Community

FAQs

Package last updated on 17 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts