diff --git a/package.json b/package.json index d2b4abbdf8..fa842738b3 100644 --- a/package.json +++ b/package.json @@ -37,14 +37,13 @@ }, "homepage": "https://github.com/ipfs/js-ipfs#readme", "devDependencies": { - "aegir": "^2.1.1", + "aegir": "^2.1.2", "async": "^1.5.2", "buffer-loader": "0.0.1", "chai": "^3.5.0", "expose-loader": "^0.7.1", "form-data": "^1.0.0-rc3", - "idb-plus-blob-store": "^1.0.0", - "local-storage-blob-store": "0.0.3", + "idb-plus-blob-store": "^1.1.2", "lodash": "^4.11.1", "mocha": "^2.3.4", "ncp": "^2.0.0", @@ -70,7 +69,7 @@ "ipfs-multipart": "^0.1.0", "ipfs-repo": "^0.6.1", "joi": "^8.0.2", - "libp2p-ipfs": "^0.3.1", + "libp2p-ipfs": "^0.3.3", "lodash.get": "^4.2.1", "lodash.set": "^4.0.0", "multiaddr": "^1.3.0", @@ -111,4 +110,4 @@ "kumavis ", "nginnever " ] -} \ No newline at end of file +} diff --git a/src/core/index.js b/src/core/index.js index 8a91870c25..91cf18522a 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -205,7 +205,9 @@ function IPFS (repo) { patch: { appendData: (multihash, data, callback) => { this.object.get(multihash, (err, obj) => { - if (err) { return callback(err) } + if (err) { + return callback(err) + } obj.data = Buffer.concat([obj.data, data]) dagS.add(obj, (err) => { if (err) { @@ -217,7 +219,9 @@ function IPFS (repo) { }, addLink: (multihash, link, callback) => { this.object.get(multihash, (err, obj) => { - if (err) { return callback(err) } + if (err) { + return callback(err) + } obj.addRawLink(link) dagS.add(obj, (err) => { if (err) { @@ -229,7 +233,9 @@ function IPFS (repo) { }, rmLink: (multihash, linkRef, callback) => { this.object.get(multihash, (err, obj) => { - if (err) { return callback(err) } + if (err) { + return callback(err) + } obj.links = obj.links.filter((link) => { // filter by name when linkRef is a string, or by hash otherwise if (typeof linkRef === 'string') { diff --git a/src/http-api/index.js b/src/http-api/index.js index fc0c490773..6289a1e12b 100644 --- a/src/http-api/index.js +++ b/src/http-api/index.js @@ -89,8 +89,15 @@ exports = module.exports = function HttpApi (repo) { this.stop = (callback) => { const repoPath = this.ipfs.repo.path() fs.unlinkSync(path.join(repoPath, 'api')) - this.ipfs.libp2p.stop(() => { - this.server.stop(callback) - }) + let counter = 0 + + this.server.stop(closed) + this.ipfs.libp2p.stop(closed) + + function closed () { + if (++counter === 2) { + callback() + } + } } } diff --git a/test/http-api-tests/index.js b/test/http-api-tests/index.js index f43c3f1c8f..4f0ab45962 100644 --- a/test/http-api-tests/index.js +++ b/test/http-api-tests/index.js @@ -28,7 +28,6 @@ describe('http api', () => { after((done) => { api.stop((err) => { expect(err).to.not.exist - clean(repoTests) done() }) diff --git a/test/http-api-tests/test-config.js b/test/http-api-tests/test-config.js index e1cab4670f..31d678a3e5 100644 --- a/test/http-api-tests/test-config.js +++ b/test/http-api-tests/test-config.js @@ -99,7 +99,7 @@ module.exports = (httpAPI) => { it('updates value for request with both args and JSON flag with valid JSON argument', (done) => { api.inject({ method: 'POST', - url: '/api/v0/config?arg=Datastore.Path&arg={\"kitten\": true}&json' + url: '/api/v0/config?arg=Datastore.Path&arg={"kitten": true}&json' }, (res) => { expect(res.statusCode).to.equal(200) expect(res.result.Key).to.equal('Datastore.Path')