mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-07-08 16:21:33 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
6cf3723019 | |||
01e240420d | |||
ff0313721c |
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,3 +1,13 @@
|
|||||||
|
<a name="0.2.0"></a>
|
||||||
|
# [0.2.0](https://github.com/libp2p/js-interfaces/compare/v0.1.7...v0.2.0) (2019-12-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* transport should not handle connection if upgradeInbound throws ([#16](https://github.com/libp2p/js-interfaces/issues/16)) ([ff03137](https://github.com/libp2p/js-interfaces/commit/ff03137))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.1.7"></a>
|
<a name="0.1.7"></a>
|
||||||
## [0.1.7](https://github.com/libp2p/js-interfaces/compare/v0.1.6...v0.1.7) (2019-12-15)
|
## [0.1.7](https://github.com/libp2p/js-interfaces/compare/v0.1.6...v0.1.7) (2019-12-15)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "libp2p-interfaces",
|
"name": "libp2p-interfaces",
|
||||||
"version": "0.1.7",
|
"version": "0.2.0",
|
||||||
"description": "Interfaces for JS Libp2p",
|
"description": "Interfaces for JS Libp2p",
|
||||||
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
|
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
@ -46,6 +46,7 @@
|
|||||||
"libp2p-tcp": "^0.14.1",
|
"libp2p-tcp": "^0.14.1",
|
||||||
"multiaddr": "^7.1.0",
|
"multiaddr": "^7.1.0",
|
||||||
"p-limit": "^2.2.1",
|
"p-limit": "^2.2.1",
|
||||||
|
"p-wait-for": "^3.1.0",
|
||||||
"peer-id": "^0.13.3",
|
"peer-id": "^0.13.3",
|
||||||
"sinon": "^7.5.0",
|
"sinon": "^7.5.0",
|
||||||
"streaming-iterables": "^4.1.0"
|
"streaming-iterables": "^4.1.0"
|
||||||
|
@ -8,6 +8,7 @@ const expect = chai.expect
|
|||||||
chai.use(dirtyChai)
|
chai.use(dirtyChai)
|
||||||
const sinon = require('sinon')
|
const sinon = require('sinon')
|
||||||
|
|
||||||
|
const pWaitFor = require('p-wait-for')
|
||||||
const pipe = require('it-pipe')
|
const pipe = require('it-pipe')
|
||||||
const { isValidTick } = require('./utils')
|
const { isValidTick } = require('./utils')
|
||||||
|
|
||||||
@ -92,6 +93,23 @@ module.exports = (common) => {
|
|||||||
expect(upgradeSpy.callCount).to.equal(2)
|
expect(upgradeSpy.callCount).to.equal(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should not handle connection if upgradeInbound throws', async () => {
|
||||||
|
sinon.stub(upgrader, 'upgradeInbound').throws()
|
||||||
|
|
||||||
|
const listener = transport.createListener(() => {
|
||||||
|
throw new Error('should not handle the connection if upgradeInbound throws')
|
||||||
|
})
|
||||||
|
|
||||||
|
// Listen
|
||||||
|
await listener.listen(addrs[0])
|
||||||
|
|
||||||
|
// Create a connection to the listener
|
||||||
|
const socket = await transport.dial(addrs[0])
|
||||||
|
|
||||||
|
await pWaitFor(() => typeof socket.timeline.close === 'number')
|
||||||
|
await listener.close()
|
||||||
|
})
|
||||||
|
|
||||||
describe('events', () => {
|
describe('events', () => {
|
||||||
it('connection', (done) => {
|
it('connection', (done) => {
|
||||||
const upgradeSpy = sinon.spy(upgrader, 'upgradeInbound')
|
const upgradeSpy = sinon.spy(upgrader, 'upgradeInbound')
|
||||||
|
Reference in New Issue
Block a user