diff --git a/tests/libp2p-tcp-test.js b/tests/libp2p-tcp-test.js index cc30764..0d91b6f 100644 --- a/tests/libp2p-tcp-test.js +++ b/tests/libp2p-tcp-test.js @@ -15,6 +15,19 @@ describe('libp2p-tcp', function () { 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) => { const mh = multiaddr('/ip4/127.0.0.1/tcp/9090') tcp.createListener(mh, (socket) => { @@ -88,5 +101,14 @@ describe('libp2p-tcp', function () { 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) => {}) })