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

Commit

Permalink
Add test for empty directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
hackergrrl committed Jun 1, 2016
1 parent aaacdcb commit 36b64a2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,29 @@ module.exports = (common) => {
path: `test-folder/${name}`,
content: fs.readFileSync(path.join(base, name))
})
const emptyDir = (name) => ({
path: `test-folder/${name}`,
dir: true
})
const dirs = [
content('pp.txt'),
content('holmes.txt'),
content('jungle.txt'),
content('alice.txt'),
emptyDir('empty-folder'),
content('files/hello.txt'),
content('files/ipfs.txt'),
emptyDir('files/empty')
]

ipfs.files.add(dirs, (err, res) => {
expect(err).to.not.exist

const added = res[res.length - 1]
const mh = bs58.encode(added.node.multihash()).toString()
expect(mh).to.equal('QmW2d9LPX4KxpeLDyH3tqYnHrkRMHx8xMQp9cpXEEj2DyR')
expect(mh).to.equal('QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP')
expect(added.path).to.equal('test-folder')
expect(added.node.links).to.have.length(5)
expect(added.node.links).to.have.length(6)
done()
})
})
Expand Down

0 comments on commit 36b64a2

Please sign in to comment.