diff --git a/CHANGELOG.md b/CHANGELOG.md
index a31a9484..eae402cd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+
+# [0.93.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.92.0...v0.93.0) (2018-12-14)
+
+
+### Bug Fixes
+
+* allow only by object ([#407](https://github.com/ipfs/interface-ipfs-core/issues/407)) ([1766ef4](https://github.com/ipfs/interface-ipfs-core/commit/1766ef4))
+* dht find peer ([#418](https://github.com/ipfs/interface-ipfs-core/issues/418)) ([8b890b6](https://github.com/ipfs/interface-ipfs-core/commit/8b890b6))
+
+
+
# [0.92.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.91.1...v0.92.0) (2018-12-12)
diff --git a/js/src/dht/findpeer.js b/js/src/dht/findpeer.js
index 980a2689..028ebb15 100644
--- a/js/src/dht/findpeer.js
+++ b/js/src/dht/findpeer.js
@@ -5,8 +5,6 @@ const { spawnNodesWithId } = require('../utils/spawn')
const { getDescribe, getIt, expect } = require('../utils/mocha')
const { connect } = require('../utils/swarm')
-const checkAll = (bits) => string => bits.every(bit => string.includes(bit))
-
module.exports = (createCommon, options) => {
const describe = getDescribe(options)
const it = getIt(options)
@@ -48,10 +46,11 @@ module.exports = (createCommon, options) => {
expect(err).to.not.exist()
const id = res.id.toB58String()
- const addrs = res.multiaddrs.toArray().map((ma) => ma.toString())
+ const nodeAddresses = nodeB.peerId.addresses.map((addr) => addr.split('/ipfs/')[0]) // remove '/ipfs/'
+ const peerAddresses = res.multiaddrs.toArray().map((ma) => ma.toString().split('/ipfs/')[0])
expect(id).to.be.eql(nodeB.peerId.id)
- expect(nodeB.peerId.addresses[0]).to.satisfy(checkAll([addrs[0]]))
+ expect(nodeAddresses).to.include(peerAddresses[0])
done()
})
})
diff --git a/js/src/files-regular/ls.js b/js/src/files-regular/ls.js
index 286d02bb..bab3544c 100644
--- a/js/src/files-regular/ls.js
+++ b/js/src/files-regular/ls.js
@@ -1,10 +1,13 @@
/* eslint-env mocha */
+/* eslint max-nested-callbacks: ["error", 6] */
'use strict'
const { fixtures } = require('./utils')
const { getDescribe, getIt, expect } = require('../utils/mocha')
const CID = require('cids')
+const randomName = prefix => `${prefix}${Math.round(Math.random() * 1000)}`
+
module.exports = (createCommon, options) => {
const describe = getDescribe(options)
const it = getIt(options)
@@ -106,7 +109,6 @@ module.exports = (createCommon, options) => {
})
it('should ls files added as CIDv0 with a CIDv1', done => {
- const randomName = prefix => `${prefix}${Math.round(Math.random() * 1000)}`
const dir = randomName('DIR')
const input = [
@@ -134,7 +136,6 @@ module.exports = (createCommon, options) => {
})
it('should ls files added as CIDv1 with a CIDv0', done => {
- const randomName = prefix => `${prefix}${Math.round(Math.random() * 1000)}`
const dir = randomName('DIR')
const input = [
@@ -176,5 +177,27 @@ module.exports = (createCommon, options) => {
done()
})
})
+
+ it('should ls files by path', done => {
+ const dir = randomName('DIR')
+
+ const input = [
+ { path: `${dir}/${randomName('F0')}`, content: Buffer.from(randomName('D0')) },
+ { path: `${dir}/${randomName('F1')}`, content: Buffer.from(randomName('D1')) }
+ ]
+
+ ipfs.add(input, (err, res) => {
+ expect(err).to.not.exist()
+
+ ipfs.ls(`/ipfs/${res[res.length - 1].hash}`, (err, output) => {
+ expect(err).to.not.exist()
+ expect(output.length).to.equal(input.length)
+ output.forEach(({ hash }) => {
+ expect(res.find(file => file.hash === hash)).to.exist()
+ })
+ done()
+ })
+ })
+ })
})
}
diff --git a/js/src/utils/mocha.js b/js/src/utils/mocha.js
index c21ae873..d9fe0fb6 100644
--- a/js/src/utils/mocha.js
+++ b/js/src/utils/mocha.js
@@ -59,14 +59,21 @@ function getIt (config) {
}
if (Array.isArray(config.only)) {
- if (config.only.includes(name)) return it.only(name, impl) // eslint-disable-line
+ const only = config.only
+ .map((o) => isObject(o) ? o : { name: o })
+ .find((o) => o.name === name)
+
+ if (only) {
+ if (only.reason) name = `${name} (${only.reason})`
+ return it.only(name, impl) // eslint-disable-line no-only-tests/no-only-tests
+ }
}
it(name, impl)
}
_it.skip = it.skip
- _it.only = it.only // eslint-disable-line
+ _it.only = it.only // eslint-disable-line no-only-tests/no-only-tests
return _it
}
diff --git a/package.json b/package.json
index c756f419..b839ee07 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "interface-ipfs-core",
- "version": "0.92.0",
+ "version": "0.93.0",
"description": "A test suite and interface you can use to implement a IPFS core interface.",
"leadMaintainer": "Alan Shaw ",
"main": "js/src/index.js",