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

Commit c8552a4

Browse files
committed
tests: test exporter maxDepth
1 parent 381998c commit c8552a4

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/exporter.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,42 @@ module.exports = (repo) => {
151151
)
152152
}).timeout(30 * 1000)
153153

154+
it('export a directory one deep', (done) => {
155+
const hash = 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN'
156+
157+
pull(
158+
exporter(hash, ipldResolver, { maxDepth: 1}),
159+
pull.collect((err, files) => {
160+
expect(err).to.not.exist()
161+
files.forEach(file => expect(file).to.have.property('hash'))
162+
163+
expect(
164+
files.map((file) => file.path)
165+
).to.be.eql([
166+
'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN',
167+
'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/200Bytes.txt',
168+
'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/dir-another',
169+
'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/level-1'
170+
])
171+
172+
pull(
173+
pull.values(files),
174+
pull.map((file) => Boolean(file.content)),
175+
pull.collect((err, contents) => {
176+
expect(err).to.not.exist()
177+
expect(contents).to.be.eql([
178+
false,
179+
true,
180+
false,
181+
false
182+
])
183+
done()
184+
})
185+
)
186+
})
187+
)
188+
}).timeout(30 * 1000)
189+
154190
it('returns an empty stream for dir', (done) => {
155191
const hash = 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn'
156192

0 commit comments

Comments
 (0)