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

Commit 9b3333a

Browse files
committed
Add ipfs.files.test for a directory.
1 parent 16a006f commit 9b3333a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/files.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,29 @@ module.exports = (common) => {
337337
})
338338
})
339339

340+
it('directory', (done) => {
341+
const hash = 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP'
342+
ipfs.files.get(hash, (err, stream) => {
343+
expect(err).to.not.exist
344+
stream.pipe(concat((files) => {
345+
expect(files).to.be.length(8)
346+
var paths = files.map(function (file) {
347+
return file.path
348+
})
349+
expect(paths).to.deep.equal([
350+
"QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/alice.txt"
351+
"QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/empty-folder"
352+
"QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/holmes.txt"
353+
"QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/jungle.txt"
354+
"QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/pp.txt"
355+
"QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files/empty"
356+
"QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files/hello.txt"
357+
"QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files/ipfs.txt"
358+
])
359+
}))
360+
})
361+
})
362+
340363
describe('promise', () => {
341364
it('with a base58 encoded string', (done) => {
342365
const hash = 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB'

0 commit comments

Comments
 (0)