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

Commit bd1b060

Browse files
author
Alan Shaw
authored
test: add test for deeply nested file (#448)
License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 05c07df commit bd1b060

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/files-regular/cat.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,23 @@ module.exports = (createCommon, options) => {
150150
})
151151
})
152152

153+
it('should cat with IPFS path, deeply nested value', (done) => {
154+
const file = { path: 'a/b/testfile.txt', content: fixtures.smallFile.data }
155+
156+
ipfs.add([file], (err, filesAdded) => {
157+
expect(err).to.not.exist()
158+
159+
const file = filesAdded.find((f) => f.path === 'a')
160+
expect(file).to.exist()
161+
162+
ipfs.cat(`/ipfs/${file.hash}/b/testfile.txt`, (err, data) => {
163+
expect(err).to.not.exist()
164+
expect(data.toString()).to.contain('Plz add me!')
165+
done()
166+
})
167+
})
168+
})
169+
153170
it('should error on invalid key (promised)', () => {
154171
const invalidCid = 'somethingNotMultihash'
155172

0 commit comments

Comments
 (0)