diff --git a/js/src/files-mfs.js b/js/src/files-mfs.js index 948c5fc5e..2d8a07225 100644 --- a/js/src/files-mfs.js +++ b/js/src/files-mfs.js @@ -5,6 +5,7 @@ const chai = require('chai') const dirtyChai = require('dirty-chai') +const loadFixture = require('aegir/fixtures') const expect = chai.expect chai.use(dirtyChai) @@ -477,8 +478,13 @@ module.exports = (common) => { }) }) - // TODO (achingbrain) - Not yet supported in js-ipfs or go-ipfs yet') + // TODO: (achingbrain) - Not yet supported in js-ipfs or go-ipfs yet') describe.skip('.stat', () => { + const smallFile = { + cid: 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP', + data: loadFixture('js/test/fixtures/testfile.txt', 'interface-ipfs-core') + } + before((done) => ipfs.files.add(smallFile.data, done)) it.skip('stat outside of mfs', function (done) { diff --git a/js/src/files.js b/js/src/files.js index 884726132..ff8f3a961 100644 --- a/js/src/files.js +++ b/js/src/files.js @@ -32,11 +32,6 @@ module.exports = (common) => { return loadFixture(path, 'interface-ipfs-core') } - const wrapDirectory = { - path: 'wrapper/', - cid: 'QmbzKtHxQXJnWG9VR66TscUfcoK3CV4nceRsCdyAEsEj9A' - } - const smallFile = { cid: 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP', data: fixture('js/test/fixtures/testfile.txt') @@ -339,11 +334,11 @@ module.exports = (common) => { it('files.add with only-hash=true', () => { this.slow(10 * 1000) const content = String(Math.random() + Date.now()) - + return ipfs.files.add(Buffer.from(content), { onlyHash: true }) .then(files => { expect(files).to.have.length(1) - + // 'ipfs.object.get()' should timeout because content wasn't actually added return expectTimeout(ipfs.object.get(files[0].hash), 4000) }) diff --git a/js/src/index.js b/js/src/index.js index 881e50145..7db37eb54 100644 --- a/js/src/index.js +++ b/js/src/index.js @@ -17,3 +17,4 @@ exports.stats = require('./stats') exports.repo = require('./repo') exports.bootstrap = require('./bootstrap') exports.types = require('./types') +exports.util = require('./util') diff --git a/js/src/stats.js b/js/src/stats.js index df9cf1e72..83441e024 100644 --- a/js/src/stats.js +++ b/js/src/stats.js @@ -13,7 +13,6 @@ chai.use(dirtyChai) module.exports = (common) => { describe('.stats', () => { let ipfs - let withGo before(function (done) { // CI takes longer to instantiate the daemon, so we need to increase the @@ -25,11 +24,7 @@ module.exports = (common) => { factory.spawnNode((err, node) => { expect(err).to.not.exist() ipfs = node - node.id((err, id) => { - expect(err).to.not.exist() - withGo = id.agentVersion.startsWith('go-ipfs') - done() - }) + done() }) }) }) diff --git a/js/src/util.js b/js/src/util.js index 7e884d711..b64ef2b3c 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -3,38 +3,39 @@ const crypto = require('libp2p-crypto') const isIPFS = require('is-ipfs') - const chai = require('chai') const dirtyChai = require('dirty-chai') const expect = chai.expect chai.use(dirtyChai) -describe('.types', function () { - let ipfs +module.exports = (common) => { + describe('.util', function () { + let ipfs - before(function (done) { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(function (done) { + // CI takes longer to instantiate the daemon, so we need to increase the + // timeout for the before step + this.timeout(60 * 1000) - common.setup((err, factory) => { - expect(err).to.not.exist() - factory.spawnNode((err, node) => { + common.setup((err, factory) => { expect(err).to.not.exist() - ipfs = node - done() + factory.spawnNode((err, node) => { + expect(err).to.not.exist() + ipfs = node + done() + }) }) }) - }) - after((done) => { - common.teardown(done) - }) + after((done) => { + common.teardown(done) + }) - it('util object', () => { - expect(ipfs.util).to.be.deep.equal({ - crypto: crypto, - isIPFS: isIPFS + it('util object', () => { + expect(ipfs.util).to.be.deep.equal({ + crypto: crypto, + isIPFS: isIPFS + }) }) }) -}) +} diff --git a/js/src/utils/stats.js b/js/src/utils/stats.js index 24440a71b..d9c56f07c 100644 --- a/js/src/utils/stats.js +++ b/js/src/utils/stats.js @@ -3,7 +3,6 @@ 'use strict' -const Big = require('big.js') const { expect } = require('chai') const isBigInt = (n) => {