mirror of
https://github.com/fluencelabs/js-libp2p-tcp
synced 2025-06-19 13:31:38 +00:00
Improves test coverage.
This commit is contained in:
@ -15,6 +15,19 @@ describe('libp2p-tcp', function () {
|
|||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('create without new', (done) => {
|
||||||
|
tcp = TCPlibp2p()
|
||||||
|
expect(tcp).to.exist
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('close /wo listeners', (done) => {
|
||||||
|
tcp = new TCPlibp2p()
|
||||||
|
expect(tcp).to.exist
|
||||||
|
expect(function () { tcp.close() }).to.throw(Error)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
|
||||||
it('listen', (done) => {
|
it('listen', (done) => {
|
||||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090')
|
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090')
|
||||||
tcp.createListener(mh, (socket) => {
|
tcp.createListener(mh, (socket) => {
|
||||||
@ -88,5 +101,14 @@ describe('libp2p-tcp', function () {
|
|||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('filter a valid addr for this transport', (done) => {
|
||||||
|
const mh1 = multiaddr('/ip4/127.0.0.1/tcp/9090')
|
||||||
|
|
||||||
|
const valid = tcp.filter(mh1)
|
||||||
|
expect(valid.length).to.equal(1)
|
||||||
|
expect(valid[0]).to.deep.equal(mh1)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
|
||||||
it.skip('listen on IPv6', (done) => {})
|
it.skip('listen on IPv6', (done) => {})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user