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

Commit 36b64a2

Browse files
committed
Add test for empty directories.
1 parent aaacdcb commit 36b64a2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/files.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,29 @@ module.exports = (common) => {
120120
path: `test-folder/${name}`,
121121
content: fs.readFileSync(path.join(base, name))
122122
})
123+
const emptyDir = (name) => ({
124+
path: `test-folder/${name}`,
125+
dir: true
126+
})
123127
const dirs = [
124128
content('pp.txt'),
125129
content('holmes.txt'),
126130
content('jungle.txt'),
127131
content('alice.txt'),
132+
emptyDir('empty-folder'),
128133
content('files/hello.txt'),
129134
content('files/ipfs.txt'),
135+
emptyDir('files/empty')
130136
]
131137

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

135141
const added = res[res.length - 1]
136142
const mh = bs58.encode(added.node.multihash()).toString()
137-
expect(mh).to.equal('QmW2d9LPX4KxpeLDyH3tqYnHrkRMHx8xMQp9cpXEEj2DyR')
143+
expect(mh).to.equal('QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP')
138144
expect(added.path).to.equal('test-folder')
139-
expect(added.node.links).to.have.length(5)
145+
expect(added.node.links).to.have.length(6)
140146
done()
141147
})
142148
})

0 commit comments

Comments
 (0)