fix(tests): got ipfs-coord lib to 100% test coverage

This commit is contained in:
Chris Troutner
2022-09-17 14:51:57 -07:00
parent 3203e56a4d
commit 33d06e99e8
+16 -1
View File
@@ -52,7 +52,7 @@ describe('#IPFS', () => {
it('should get the public IP address if this node is a Circuit Relay', async () => {
// Mock dependencies.
uut.IpfsCoord = IPFSCoordMock
sandbox.stub(uut.publicIp, 'v4').returns('123')
sandbox.stub(uut.publicIp, 'v4').resolves('123')
// Force Circuit Relay
uut.config.isCircuitRelay = true
@@ -62,6 +62,21 @@ describe('#IPFS', () => {
assert.equal(result, true)
})
it('should exit quietly if this node is a Circuit Relay and there is an issue getting the IP address', async () => {
// Mock dependencies.
uut.IpfsCoord = IPFSCoordMock
sandbox.stub(uut.publicIp, 'v4').rejects(new Error('test error'))
// Force Circuit Relay
uut.config.isCircuitRelay = true
const result = await uut.start()
// console.log('result: ', result)
assert.equal(result, true)
})
it('should return a promise that resolves into an instance of IPFS in production mode', async () => {
uut.config.isProduction = true
// Mock dependencies.