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

Commit

Permalink
fix: bootstrap rm return value when all option is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Santos committed Nov 25, 2019
1 parent 0671a5e commit 765d2a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/core/components/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,17 @@ module.exports = function bootstrap (self) {
throw invalidMultiaddrError(multiaddr)
}

let res = []
const config = await self._repo.config.get()
if (args.all) {
res = config.Bootstrap
config.Bootstrap = []
} else {
config.Bootstrap = config.Bootstrap.filter((mh) => mh !== multiaddr)
}

await self._repo.config.set(config)

const res = []
if (!args.all && multiaddr) {
res.push(multiaddr)
}
Expand Down
10 changes: 6 additions & 4 deletions test/cli/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ describe('bootstrap', () => runOnAndOff((thing) => {
it('rm all bootstrap nodes', async function () {
this.timeout(40 * 1000)

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

const out2 = await ipfs('bootstrap list')
expect(out2).to.equal('')
const outRm = await ipfs('bootstrap rm --all')
expect(outRm).to.equal(outListBefore)

const outListAfter = await ipfs('bootstrap list')
expect(outListAfter).to.equal('')
})
}))

0 comments on commit 765d2a3

Please sign in to comment.