This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ module.exports = (common) => {
152
152
let progress = 0
153
153
const handler = ( p ) => {
154
154
progCount += 1
155
- progress = p
155
+ progress + = p
156
156
}
157
157
158
158
ipfs . files . add ( bigFile , { progress : handler } , ( err , res ) => {
@@ -162,7 +162,7 @@ module.exports = (common) => {
162
162
expect ( file . hash ) . to . equal ( expectedMultihash )
163
163
expect ( file . path ) . to . equal ( file . hash )
164
164
expect ( progCount ) . to . equal ( 58 )
165
- expect ( progress ) . to . equal ( 57792 )
165
+ expect ( progress ) . to . equal ( bigFile . byteLength )
166
166
done ( )
167
167
} )
168
168
} )
@@ -281,11 +281,15 @@ module.exports = (common) => {
281
281
emptyDir ( 'files/empty' )
282
282
]
283
283
284
+ const total = dirs . reduce ( ( i , entry ) => {
285
+ return i + ( entry . content ? entry . content . length : 0 )
286
+ } , 0 )
287
+
284
288
let progCount = 0
285
289
let progress = 0
286
290
const handler = ( p ) => {
287
291
progCount += 1
288
- progress = p
292
+ progress + = p
289
293
}
290
294
291
295
ipfs . files . add ( dirs , { progress : handler } , ( err , res ) => {
@@ -295,7 +299,7 @@ module.exports = (common) => {
295
299
expect ( root . path ) . to . equal ( 'test-folder' )
296
300
expect ( root . hash ) . to . equal ( expectedRootMultihash )
297
301
expect ( progCount ) . to . equal ( 8 )
298
- expect ( progress ) . to . equal ( 5 )
302
+ expect ( progress ) . to . equal ( total )
299
303
done ( )
300
304
} )
301
305
} )
You can’t perform that action at this time.
0 commit comments