An open API service indexing awesome lists of open source software.

https://github.com/libp2p/interop

Interoperability tests for libp2p Implementations
https://github.com/libp2p/interop

Last synced: about 1 year ago
JSON representation

Interoperability tests for libp2p Implementations

Awesome Lists containing this project

README

          

[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
[![codecov](https://img.shields.io/codecov/c/github/libp2p/interop.svg?style=flat-square)](https://codecov.io/gh/libp2p/interop)
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/interop/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/libp2p/interop/actions/workflows/js-test-and-release.yml?query=branch%3Amain)

> Interoperability Tests for libp2p

# About

This repository holds interop tests for testing compatibility between different libp2p implementations.

## Example - How to run the tests

Create a js file that configures the different types of daemon:

```js
import { interopTests } from '@libp2p/interop'
import type { Daemon, DaemonFactory } from '@libp2p/interop'

async function createGoPeer (options: SpawnOptions): Promise {
// your implementation here
}

async function createJsPeer (options: SpawnOptions): Promise {
// your implementation here
}

async function main () {
const factory: DaemonFactory = {
async spawn (options: SpawnOptions) {
if (options.type === 'go') {
return createGoPeer(options)
}

return createJsPeer(options)
}
}

interopTests(factory)
}

main().catch(err => {
console.error(err)
process.exit(1)
})
```

For an example, see the js-libp2p interop test runner.

# Install

```console
$ npm i @libp2p/interop
```

# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / )
- MIT ([LICENSE-MIT](LICENSE-MIT) / )

# 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.