From 11a17d9d993a661424fee4517aa32386ae6c701c Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Tue, 3 May 2016 10:43:36 +0200 Subject: [PATCH 1/3] chore(package): update aegir to version 3.0.1 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 357757214..e1266f6a8 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "devDependencies": { "chai": "^3.5.0", - "aegir": "^2.1.1", + "aegir": "^3.0.1", "gulp": "^3.9.1", "ipfsd-ctl": "^0.11.0", "pre-commit": "^1.1.2", From 67034d5162af9982b5bb76711d4b633b35971b01 Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Tue, 3 May 2016 12:44:26 +0200 Subject: [PATCH 2/3] style: eslint happy --- src/index.js | 8 ++++---- test/api/config.spec.js | 24 ++++++++++++------------ test/api/swarm.spec.js | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/index.js b/src/index.js index bcc6df48c..e47af2fd3 100644 --- a/src/index.js +++ b/src/index.js @@ -6,16 +6,16 @@ const loadCommands = require('./load-commands') const getConfig = require('./config') const getRequestAPI = require('./request-api') -function IpfsAPI (host_or_multiaddr, port, opts) { +function IpfsAPI (hostOrMultiaddr, port, opts) { const config = getConfig() try { - const maddr = multiaddr(host_or_multiaddr).nodeAddress() + const maddr = multiaddr(hostOrMultiaddr).nodeAddress() config.host = maddr.address config.port = maddr.port } catch (e) { - if (typeof host_or_multiaddr === 'string') { - config.host = host_or_multiaddr + if (typeof hostOrMultiaddr === 'string') { + config.host = hostOrMultiaddr config.port = port && typeof port !== 'object' ? port : config.port } } diff --git a/test/api/config.spec.js b/test/api/config.spec.js index 87c1f01dd..21ca82d8e 100644 --- a/test/api/config.spec.js +++ b/test/api/config.spec.js @@ -12,9 +12,9 @@ describe('.config', () => { const confKey = 'arbitraryKey' const confVal = 'arbitraryVal' - apiClients['a'].config.set(confKey, confVal, (err, res) => { + apiClients.a.config.set(confKey, confVal, (err, res) => { expect(err).to.not.exist - apiClients['a'].config.get(confKey, (err, res) => { + apiClients.a.config.get(confKey, (err, res) => { expect(err).to.not.exist expect(res).to.have.a.property('Value', confVal) done() @@ -26,9 +26,9 @@ describe('.config', () => { const confKey = 'otherKey' const confVal = true - apiClients['a'].config.set(confKey, confVal, (err, res) => { + apiClients.a.config.set(confKey, confVal, (err, res) => { expect(err).to.not.exist - apiClients['a'].config.get(confKey, (err, res) => { + apiClients.a.config.get(confKey, (err, res) => { expect(err).to.not.exist expect(res.Value).to.deep.equal(confVal) done() @@ -40,9 +40,9 @@ describe('.config', () => { const confKey = 'API.HTTPHeaders.Access-Control-Allow-Origin' const confVal = ['http://example.io'] - apiClients['a'].config.set(confKey, confVal, (err, res) => { + apiClients.a.config.set(confKey, confVal, (err, res) => { expect(err).to.not.exist - apiClients['a'].config.get(confKey, (err, res) => { + apiClients.a.config.get(confKey, (err, res) => { expect(err).to.not.exist expect(res.Value).to.deep.equal(confVal) done() @@ -77,9 +77,9 @@ describe('.config', () => { const confKey = 'arbitraryKey' const confVal = 'arbitraryVal' - return apiClients['a'].config.set(confKey, confVal) + return apiClients.a.config.set(confKey, confVal) .then((res) => { - return apiClients['a'].config.get(confKey) + return apiClients.a.config.get(confKey) }) .then((res) => { expect(res).to.have.a.property('Value', confVal) @@ -90,9 +90,9 @@ describe('.config', () => { const confKey = 'otherKey' const confVal = true - return apiClients['a'].config.set(confKey, confVal) + return apiClients.a.config.set(confKey, confVal) .then((res) => { - return apiClients['a'].config.get(confKey) + return apiClients.a.config.get(confKey) }) .then((res) => { expect(res.Value).to.deep.equal(confVal) @@ -103,9 +103,9 @@ describe('.config', () => { const confKey = 'API.HTTPHeaders.Access-Control-Allow-Origin' const confVal = ['http://example.com'] - return apiClients['a'].config.set(confKey, confVal) + return apiClients.a.config.set(confKey, confVal) .then((res) => { - return apiClients['a'].config.get(confKey) + return apiClients.a.config.get(confKey) }) .then((res) => { expect(res.Value).to.deep.equal(confVal) diff --git a/test/api/swarm.spec.js b/test/api/swarm.spec.js index f10020ffd..18f89115c 100644 --- a/test/api/swarm.spec.js +++ b/test/api/swarm.spec.js @@ -25,7 +25,7 @@ describe('.swarm', () => { }) it('.swarm.addrs', (done) => { - apiClients['a'].swarm.addrs((err, res) => { + apiClients.a.swarm.addrs((err, res) => { expect(err).to.not.exist expect(Object.keys(res.Addrs)).to.have.length.above(1) @@ -34,7 +34,7 @@ describe('.swarm', () => { }) it('.swarm.localAddrs', (done) => { - apiClients['a'].swarm.localAddrs((err, res) => { + apiClients.a.swarm.localAddrs((err, res) => { expect(err).to.not.exist expect(res.Strings).to.have.length.above(1) @@ -51,14 +51,14 @@ describe('.swarm', () => { }) it('.swarm.addrs', () => { - return apiClients['a'].swarm.addrs() + return apiClients.a.swarm.addrs() .then((res) => { expect(Object.keys(res.Addrs)).to.have.length.above(1) }) }) it('.swarm.localAddrs', () => { - return apiClients['a'].swarm.localAddrs() + return apiClients.a.swarm.localAddrs() .then((res) => { expect(res.Strings).to.have.length.above(1) }) From d7aadff0ad471dccf30095d5be1879cfd5f3ab95 Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Tue, 3 May 2016 12:55:56 +0200 Subject: [PATCH 3/3] chore: Update ipfsd-ctl to 0.13.0 --- package.json | 2 +- test/api/object.spec.js | 24 ++++++++---------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index e1266f6a8..09cb0ca76 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "chai": "^3.5.0", "aegir": "^3.0.1", "gulp": "^3.9.1", - "ipfsd-ctl": "^0.11.0", + "ipfsd-ctl": "^0.13.0", "pre-commit": "^1.1.2", "raw-loader": "^0.5.1", "stream-equal": "^0.1.8", diff --git a/test/api/object.spec.js b/test/api/object.spec.js index b2ee60c07..e60f75e87 100644 --- a/test/api/object.spec.js +++ b/test/api/object.spec.js @@ -67,8 +67,7 @@ describe('.object', () => { expect(err).to.not.exist expect(res).to.be.eql({ - Hash: 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD', - Links: [] + Hash: 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD' }) done() }) @@ -87,8 +86,7 @@ describe('.object', () => { .addLink(testObjectHash, 'next', testPatchObjectHash, (err, res) => { expect(err).to.not.exist expect(res).to.be.eql({ - Hash: 'QmZFdJ3CQsY4kkyQtjoUo8oAzsEs5BNguxBhp8sjQMpgkd', - Links: null + Hash: 'QmZFdJ3CQsY4kkyQtjoUo8oAzsEs5BNguxBhp8sjQMpgkd' }) apiClients.a.object.get(res.Hash, (err, res) => { expect(err).to.not.exist @@ -110,8 +108,7 @@ describe('.object', () => { .rmLink('QmZFdJ3CQsY4kkyQtjoUo8oAzsEs5BNguxBhp8sjQMpgkd', 'next', (err, res) => { expect(err).to.not.exist expect(res).to.be.eql({ - Hash: testObjectHash, - Links: null + Hash: testObjectHash }) apiClients.a.object.get(res.Hash, (err, res) => { expect(err).to.not.exist @@ -129,8 +126,7 @@ describe('.object', () => { .appendData(testObjectHash, new Buffer(' hello'), (err, res) => { expect(err).to.not.exist expect(res).to.be.eql({ - Hash: 'Qmcjhr2QztQxCAoEf8tJPTGTVkTsUrTQ36JurH14DNYNsc', - Links: null + Hash: 'Qmcjhr2QztQxCAoEf8tJPTGTVkTsUrTQ36JurH14DNYNsc' }) apiClients.a.object.get(res.Hash, (err, res) => { expect(err).to.not.exist @@ -147,8 +143,7 @@ describe('.object', () => { .setData(testObjectHash, new Buffer('hello world'), (err, res) => { expect(err).to.not.exist expect(res).to.be.eql({ - Hash: 'QmU1Sq1B7RPQD2XcQNLB58qJUyJffVJqihcxmmN1STPMxf', - Links: null + Hash: 'QmU1Sq1B7RPQD2XcQNLB58qJUyJffVJqihcxmmN1STPMxf' }) apiClients.a.object.get(res.Hash, (err, res) => { expect(err).to.not.exist @@ -166,8 +161,7 @@ describe('.object', () => { apiClients.a.object.new('unixfs-dir', (err, res) => { expect(err).to.not.exist expect(res).to.deep.equal({ - Hash: 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn', - Links: null + Hash: 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn' }) done() }) @@ -226,8 +220,7 @@ describe('.object', () => { return apiClients.a.object.links(testObjectHash) .then((res) => { expect(res).to.be.eql({ - Hash: 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD', - Links: [] + Hash: 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD' }) }) }) @@ -236,8 +229,7 @@ describe('.object', () => { return apiClients.a.object.new('unixfs-dir') .then((res) => { expect(res).to.deep.equal({ - Hash: 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn', - Links: null + Hash: 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn' }) }) })