Skip to content

Commit

Permalink
test: add test for deeply nested file (ipfs#448)
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
  • Loading branch information
Alan Shaw authored Mar 13, 2019
1 parent 05c07df commit bd1b060
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/files-regular/cat.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,23 @@ module.exports = (createCommon, options) => {
})
})

it('should cat with IPFS path, deeply nested value', (done) => {
const file = { path: 'a/b/testfile.txt', content: fixtures.smallFile.data }

ipfs.add([file], (err, filesAdded) => {
expect(err).to.not.exist()

const file = filesAdded.find((f) => f.path === 'a')
expect(file).to.exist()

ipfs.cat(`/ipfs/${file.hash}/b/testfile.txt`, (err, data) => {
expect(err).to.not.exist()
expect(data.toString()).to.contain('Plz add me!')
done()
})
})
})

it('should error on invalid key (promised)', () => {
const invalidCid = 'somethingNotMultihash'

Expand Down

0 comments on commit bd1b060

Please sign in to comment.