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

Commit 0837f1c

Browse files
committed
Add ipfs.files.test for a directory.
1 parent d1817ef commit 0837f1c

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
@@ -334,6 +334,29 @@ module.exports = (common) => {
334334
})
335335
})
336336

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

0 commit comments

Comments
 (0)