This repository was archived by the owner on Aug 12, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,42 @@ module.exports = (repo) => {
151
151
)
152
152
} ) . timeout ( 30 * 1000 )
153
153
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
+
154
190
it ( 'returns an empty stream for dir' , ( done ) => {
155
191
const hash = 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn'
156
192
You can’t perform that action at this time.
0 commit comments