Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit b558ce8

Browse files
committed
ipfs-api#339 is still a thing
1 parent fb55f4f commit b558ce8

File tree

1 file changed

+36
-12
lines changed

1 file changed

+36
-12
lines changed

src/files.js

+36-12
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const concat = require('concat-stream')
1717
const through = require('through2')
1818
const path = require('path')
1919
const bl = require('bl')
20+
const isNode = require('detect-node')
2021

2122
module.exports = (common) => {
2223
describe('.files', function () {
@@ -161,6 +162,9 @@ module.exports = (common) => {
161162
})
162163

163164
it('add a nested directory as array of tupples', (done) => {
165+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
166+
if (!isNode) { return done() }
167+
164168
const content = (name) => ({
165169
path: `test-folder/${name}`,
166170
content: directory.files[name]
@@ -190,6 +194,9 @@ module.exports = (common) => {
190194
})
191195

192196
it('add a nested directory as array of tuppled with progress', (done) => {
197+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
198+
if (!isNode) { return done() }
199+
193200
const content = (name) => ({
194201
path: `test-folder/${name}`,
195202
content: directory.files[name]
@@ -251,8 +258,9 @@ module.exports = (common) => {
251258
})
252259

253260
describe('.addReadableStream', () => {
254-
it('stream of valid files and dirs', function (done) {
255-
this.timeout(40 * 1000)
261+
it('stream of valid files and dirs', (done) => {
262+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
263+
if (!isNode) { return done() }
256264

257265
const content = (name) => ({
258266
path: `test-folder/${name}`,
@@ -291,8 +299,9 @@ module.exports = (common) => {
291299
})
292300

293301
describe('.addPullStream', () => {
294-
it('stream of valid files and dirs', function (done) {
295-
this.timeout(20 * 1000)
302+
it('stream of valid files and dirs', (done) => {
303+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
304+
if (!isNode) { return done() }
296305

297306
const content = (name) => ({
298307
path: `test-folder/${name}`,
@@ -495,8 +504,9 @@ module.exports = (common) => {
495504
})
496505
})
497506

498-
it('directory', function (done) {
499-
this.timeout(40 * 1000)
507+
it('directory', (done) => {
508+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
509+
if (!isNode) { return done() }
500510

501511
series([
502512
(cb) => {
@@ -668,8 +678,10 @@ module.exports = (common) => {
668678
})
669679

670680
describe('.ls', () => {
671-
before(function (done) {
672-
this.timeout(20 * 1000)
681+
before((done) => {
682+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
683+
if (!isNode) { return done() }
684+
673685
const content = (name) => ({
674686
path: `test-folder/${name}`,
675687
content: directory.files[name]
@@ -699,6 +711,9 @@ module.exports = (common) => {
699711
})
700712

701713
it('with a base58 encoded CID', (done) => {
714+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
715+
if (!isNode) { return done() }
716+
702717
const cid = 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP'
703718
ipfs.ls(cid, (err, files) => {
704719
expect(err).to.not.exist()
@@ -763,8 +778,9 @@ module.exports = (common) => {
763778
})
764779

765780
describe('.lsReadableStream', () => {
766-
before(function (done) {
767-
this.timeout(40 * 1000)
781+
before((done) => {
782+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
783+
if (!isNode) { return done() }
768784

769785
const content = (name) => ({
770786
path: `test-folder/${name}`,
@@ -795,6 +811,9 @@ module.exports = (common) => {
795811
})
796812

797813
it('with a base58 encoded CID', (done) => {
814+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
815+
if (!isNode) { return done() }
816+
798817
const cid = 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP'
799818
const stream = ipfs.lsReadableStream(cid)
800819

@@ -843,8 +862,10 @@ module.exports = (common) => {
843862
})
844863

845864
describe('.lsPullStream', () => {
846-
before(function (done) {
847-
this.timeout(40 * 1000)
865+
before((done) => {
866+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
867+
if (!isNode) { return done() }
868+
848869
const content = (name) => ({
849870
path: `test-folder/${name}`,
850871
content: directory.files[name]
@@ -874,6 +895,9 @@ module.exports = (common) => {
874895
})
875896

876897
it('with a base58 encoded CID', (done) => {
898+
// TODO: https://github.com/ipfs/js-ipfs-api/issues/339
899+
if (!isNode) { return done() }
900+
877901
const cid = 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP'
878902
const stream = ipfs.lsPullStream(cid)
879903

0 commit comments

Comments
 (0)