fix: not started yet (#297)

* fix: callback when not started rather than throwing asserts

* fix: dont remove transports until the switch has stopped

* test: update connection check logic

* test: fix variable reference

* chore: update switch dep

* chore: update switch dep
This commit is contained in:
Jacob Heun
2018-12-14 17:54:32 +01:00
committed by GitHub
parent 15bdb795a4
commit fdfb7b4e86
7 changed files with 91 additions and 67 deletions

View File

@ -114,5 +114,29 @@ describe('libp2p state machine (fsm)', () => {
node.start()
})
it('should not dial when the node is stopped', (done) => {
node.on('stop', () => {
node.dial(null, (err) => {
expect(err).to.exist()
expect(err.code).to.eql('ERR_NODE_NOT_STARTED')
done()
})
})
node.stop()
})
it('should not dial (fsm) when the node is stopped', (done) => {
node.on('stop', () => {
node.dialFSM(null, null, (err) => {
expect(err).to.exist()
expect(err.code).to.eql('ERR_NODE_NOT_STARTED')
done()
})
})
node.stop()
})
})
})