fix(ipfs adapter): Adding unit tests for lock-file error handling

This commit is contained in:
Chris Troutner
2021-09-30 14:47:17 -07:00
parent a9e7fc616e
commit 7e228b729e
2 changed files with 20 additions and 1 deletions
@@ -45,5 +45,23 @@ describe('#IPFS-adapter-index', () => {
assert.include(err.message, 'test error')
}
})
it('should handle lock-file errors', async () => {
try {
// Force an error
sandbox
.stub(uut.ipfsAdapter, 'start')
.rejects(new Error('Lock already being held'))
// Prevent process from exiting
sandbox.stub(uut.process, 'exit').returns()
await uut.start()
assert.fail('Unexpected code path.')
} catch (err) {
assert.include(err.message, 'Lock already being held')
}
})
})
})