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

Commit

Permalink
fix: parents option and ls stream flow (#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Shaw authored Nov 19, 2019
1 parent 5d81341 commit b9df5fb
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/files-mfs/cp.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(testDir, { p: true }, cb),
(cb) => ipfs.files.mkdir(testDir, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/a`, Buffer.from('TEST'), { create: true }, cb),
(cb) => ipfs.files.cp(`${testDir}/a`, `${testDir}/b`, cb)
], (err) => {
Expand All @@ -68,7 +68,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(`${testDir}/lv1/lv2`, { p: true }, cb),
(cb) => ipfs.files.mkdir(`${testDir}/lv1/lv2`, { parents: true }, cb),
(cb) => ipfs.files.cp(`${testDir}/lv1/lv2`, `${testDir}/lv1/lv3`, cb)
], (err) => {
expect(err).to.not.exist()
Expand Down
2 changes: 1 addition & 1 deletion src/files-mfs/flush.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(testDir, { p: true }, cb),
(cb) => ipfs.files.mkdir(testDir, { parents: true }, cb),
(cb) => ipfs.files.flush(testDir, cb)
], (err) => {
expect(err).to.not.exist()
Expand Down
4 changes: 2 additions & 2 deletions src/files-mfs/ls-pull-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { p: true }, cb),
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/b`, Buffer.from('Hello, world!'), { create: true }, cb)
], (err) => {
expect(err).to.not.exist()
Expand All @@ -75,7 +75,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { p: true }, cb),
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/b`, Buffer.from('Hello, world!'), { create: true }, cb)
], (err) => {
expect(err).to.not.exist()
Expand Down
5 changes: 3 additions & 2 deletions src/files-mfs/ls-readable-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

const stream = ipfs.files.lsReadableStream(`${testDir}/404`)
stream.on('data', () => {})

stream.once('error', (err) => {
expect(err).to.exist()
Expand All @@ -48,7 +49,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { p: true }, cb),
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/b`, Buffer.from('Hello, world!'), { create: true }, cb)
], (err) => {
expect(err).to.not.exist()
Expand All @@ -72,7 +73,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { p: true }, cb),
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/b`, Buffer.from('Hello, world!'), { create: true }, cb)
], (err) => {
expect(err).to.not.exist()
Expand Down
4 changes: 2 additions & 2 deletions src/files-mfs/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { p: true }, cb),
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/b`, Buffer.from('Hello, world!'), { create: true }, cb)
], (err) => {
expect(err).to.not.exist()
Expand All @@ -67,7 +67,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { p: true }, cb),
(cb) => ipfs.files.mkdir(`${testDir}/lv1`, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/b`, Buffer.from('Hello, world!'), { create: true }, cb)
], (err) => {
expect(err).to.not.exist()
Expand Down
2 changes: 1 addition & 1 deletion src/files-mfs/mkdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = (createCommon, options) => {
it('should make directory and its parents', (done) => {
const testDir = `/test-${hat()}`

ipfs.files.mkdir(`${testDir}/lv1/lv2`, { p: true }, (err) => {
ipfs.files.mkdir(`${testDir}/lv1/lv2`, { parents: true }, (err) => {
expect(err).to.not.exist()
done()
})
Expand Down
6 changes: 3 additions & 3 deletions src/files-mfs/mv.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = (createCommon, options) => {

before((done) => {
series([
(cb) => ipfs.files.mkdir('/test/lv1/lv2', { p: true }, cb),
(cb) => ipfs.files.mkdir('/test/lv1/lv2', { parents: true }, cb),
(cb) => ipfs.files.write('/test/a', Buffer.from('Hello, world!'), { create: true }, cb)
], done)
})
Expand All @@ -52,7 +52,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(`${testDir}/lv1/lv2`, { p: true }, cb),
(cb) => ipfs.files.mkdir(`${testDir}/lv1/lv2`, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/a`, Buffer.from('Hello, world!'), { create: true }, cb)
], (err) => {
expect(err).to.not.exist()
Expand All @@ -67,7 +67,7 @@ module.exports = (createCommon, options) => {
it('should move dir, expect no error', (done) => {
const testDir = `/test-${hat()}`

ipfs.files.mkdir(`${testDir}/lv1/lv2`, { p: true }, (err) => {
ipfs.files.mkdir(`${testDir}/lv1/lv2`, { parents: true }, (err) => {
expect(err).to.not.exist()

ipfs.files.mv('/test/lv1/lv2', '/test/lv1/lv4', (err) => {
Expand Down
4 changes: 2 additions & 2 deletions src/files-mfs/rm.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(testDir, { p: true }, cb),
(cb) => ipfs.files.mkdir(testDir, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/c`, Buffer.from('Hello, world!'), { create: true }, cb)
], (err) => {
expect(err).to.not.exist()
Expand All @@ -60,7 +60,7 @@ module.exports = (createCommon, options) => {
it('should remove dir, expect no error', (done) => {
const testDir = `/test-${hat()}`

ipfs.files.mkdir(`${testDir}/lv1/lv2`, { p: true }, (err) => {
ipfs.files.mkdir(`${testDir}/lv1/lv2`, { parents: true }, (err) => {
expect(err).to.not.exist()

ipfs.files.rm(`${testDir}/lv1/lv2`, { recursive: true }, (err) => {
Expand Down
4 changes: 2 additions & 2 deletions src/files-mfs/stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(testDir, { p: true }, cb),
(cb) => ipfs.files.mkdir(testDir, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/b`, Buffer.from('Hello, world!'), { create: true }, cb)
], (err) => {
expect(err).to.not.exist()
Expand All @@ -74,7 +74,7 @@ module.exports = (createCommon, options) => {
const testDir = `/test-${hat()}`

series([
(cb) => ipfs.files.mkdir(testDir, { p: true }, cb),
(cb) => ipfs.files.mkdir(testDir, { parents: true }, cb),
(cb) => ipfs.files.write(`${testDir}/a`, Buffer.from('Hello, world!'), { create: true }, cb)
], (err) => {
expect(err).to.not.exist()
Expand Down

0 comments on commit b9df5fb

Please sign in to comment.