mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-02 15:31:04 +00:00
* chore: remove peer-info usage on topology BREAKING CHANGE: topology api now uses peer-id instead of peer-info
42 lines
946 B
JavaScript
42 lines
946 B
JavaScript
/* eslint-env mocha */
|
|
'use strict'
|
|
|
|
const tests = require('../../src/topology/tests/multicodec-topology')
|
|
const MulticodecTopology = require('../../src/topology/multicodec-topology')
|
|
const MockPeerStore = require('./mock-peer-store')
|
|
|
|
describe('multicodec topology compliance tests', () => {
|
|
tests({
|
|
setup (properties, registrar) {
|
|
const multicodecs = ['/echo/1.0.0']
|
|
const handlers = {
|
|
onConnect: () => { },
|
|
onDisconnect: () => { }
|
|
}
|
|
|
|
const topology = new MulticodecTopology({
|
|
multicodecs,
|
|
handlers,
|
|
...properties
|
|
})
|
|
|
|
if (!registrar) {
|
|
const peers = new Map()
|
|
const peerStore = new MockPeerStore(peers)
|
|
|
|
registrar = {
|
|
peerStore,
|
|
getConnection: () => { }
|
|
}
|
|
}
|
|
|
|
topology.registrar = registrar
|
|
|
|
return topology
|
|
},
|
|
teardown () {
|
|
// cleanup resources created by setup()
|
|
}
|
|
})
|
|
})
|