Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 0a94f85

Browse files
Pedro SantosAlan Shaw
Pedro Santos
authored and
Alan Shaw
committed
fix: bootstrap rm return value when all option is set (#2626)
1 parent 0671a5e commit 0a94f85

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/core/components/bootstrap.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,17 @@ module.exports = function bootstrap (self) {
4545
throw invalidMultiaddrError(multiaddr)
4646
}
4747

48+
let res = []
4849
const config = await self._repo.config.get()
4950
if (args.all) {
51+
res = config.Bootstrap
5052
config.Bootstrap = []
5153
} else {
5254
config.Bootstrap = config.Bootstrap.filter((mh) => mh !== multiaddr)
5355
}
5456

5557
await self._repo.config.set(config)
5658

57-
const res = []
5859
if (!args.all && multiaddr) {
5960
res.push(multiaddr)
6061
}

test/cli/bootstrap.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ describe('bootstrap', () => runOnAndOff((thing) => {
9494
it('rm all bootstrap nodes', async function () {
9595
this.timeout(40 * 1000)
9696

97-
const out = await ipfs('bootstrap rm --all')
98-
expect(out).to.equal('')
97+
const outListBefore = await ipfs('bootstrap list')
9998

100-
const out2 = await ipfs('bootstrap list')
101-
expect(out2).to.equal('')
99+
const outRm = await ipfs('bootstrap rm --all')
100+
expect(outRm).to.equal(outListBefore)
101+
102+
const outListAfter = await ipfs('bootstrap list')
103+
expect(outListAfter).to.equal('')
102104
})
103105
}))

test/http-api/inject/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module.exports = (http) => {
8383
})
8484

8585
expect(res.statusCode).to.be.eql(200)
86-
expect(res.result.Peers).to.be.eql([])
86+
expect(res.result.Peers).to.be.eql(defaultList)
8787
})
8888
})
8989
}

0 commit comments

Comments
 (0)