@libp2p/interface-connection-compliance-tests
TypeScript icon, indicating that this package has built-in type declarations

2.0.9 • Public • Published

@libp2p/interface-connection-compliance-tests

libp2p.io Discuss codecov CI

Compliance tests for implementations of the libp2p Connection interface

Table of contents

Install

$ npm i @libp2p/interface-connection-compliance-tests

Usage

This is a test suite and interface you can use to implement a connection. The connection interface contains all the metadata associated with it, as well as an array of the streams opened through this connection. In the same way as the connection, a stream contains properties with its metadata, plus an iterable duplex object that offers a mechanism for writing and reading data, with back pressure. This module and test suite were heavily inspired by abstract-blob-store and interface-stream-muxer.

The primary goal of this module is to enable developers to pick, swap or upgrade their connection without losing the same API expectations and mechanisms such as back pressure and the ability to half close a connection.

Publishing a test suite as a module lets multiple modules ensure compatibility since they use the same test suite.

import tests from '@libp2p/interface-connection-compliance-tests'

describe('your connection', () => {
  tests({
    // Options should be passed to your connection
    async setup (options) {
      return YourConnection
    },
    async teardown () {
      // cleanup resources created by setup()
    }
  })
})

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Readme

Keywords

Package Sidebar

Install

npm i @libp2p/interface-connection-compliance-tests

Weekly Downloads

0

Version

2.0.9

License

Apache-2.0 OR MIT

Unpacked Size

1.52 MB

Total Files

10

Last publish

Collaborators

  • jacobheun
  • npm-service-account-libp2p
  • alanshaw
  • vascosantos
  • achingbrain
  • daviddias