This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree 2 files changed +84
-3
lines changed 2 files changed +84
-3
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,10 @@ module.exports = (common) => {
276
276
blocks : 1 ,
277
277
size : 13 ,
278
278
hash : 'QmcZojhwragQr5qhTeFAmELik623Z21e3jBTpJXoQ9si1T' ,
279
- cumulativeSize : 71
279
+ cumulativeSize : 71 ,
280
+ withLocality : false ,
281
+ local : undefined ,
282
+ sizeLocal : undefined
280
283
} )
281
284
done ( )
282
285
} )
@@ -295,7 +298,54 @@ module.exports = (common) => {
295
298
blocks : 2 ,
296
299
size : 0 ,
297
300
hash : 'QmVrkkNurBCeJvPRohW5JTvJG4AxGrFg7FnmsZZUS6nJto' ,
298
- cumulativeSize : 216
301
+ cumulativeSize : 216 ,
302
+ withLocality : false ,
303
+ local : undefined ,
304
+ sizeLocal : undefined
305
+ } )
306
+ done ( )
307
+ } )
308
+ } )
309
+
310
+ it ( 'stat withLocal file' , function ( done ) {
311
+ if ( ! withGo ) {
312
+ console . log ( 'Not supported in js-ipfs yet' )
313
+ this . skip ( )
314
+ }
315
+
316
+ ipfs . files . stat ( '/test/b' , { 'withLocal' : true } , ( err , stat ) => {
317
+ expect ( err ) . to . not . exist ( )
318
+ expect ( stat ) . to . eql ( {
319
+ type : 'file' ,
320
+ blocks : 1 ,
321
+ size : 13 ,
322
+ hash : 'QmcZojhwragQr5qhTeFAmELik623Z21e3jBTpJXoQ9si1T' ,
323
+ cumulativeSize : 71 ,
324
+ withLocality : true ,
325
+ local : true ,
326
+ sizeLocal : 71
327
+ } )
328
+ done ( )
329
+ } )
330
+ } )
331
+
332
+ it ( 'stat withLocal dir' , function ( done ) {
333
+ if ( ! withGo ) {
334
+ console . log ( 'Not supported in js-ipfs yet' )
335
+ this . skip ( )
336
+ }
337
+
338
+ ipfs . files . stat ( '/test' , { 'withLocal' : true } , ( err , stat ) => {
339
+ expect ( err ) . to . not . exist ( )
340
+ expect ( stat ) . to . eql ( {
341
+ type : 'directory' ,
342
+ blocks : 2 ,
343
+ size : 0 ,
344
+ hash : 'QmVrkkNurBCeJvPRohW5JTvJG4AxGrFg7FnmsZZUS6nJto' ,
345
+ cumulativeSize : 216 ,
346
+ withLocality : true ,
347
+ local : true ,
348
+ sizeLocal : 216
299
349
} )
300
350
done ( )
301
351
} )
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ module.exports = (common) => {
24
24
this . timeout ( 40 * 1000 )
25
25
26
26
let ipfs
27
+ let withGo
27
28
28
29
function fixture ( path ) {
29
30
return loadFixture ( path , 'interface-ipfs-core' )
@@ -60,7 +61,11 @@ module.exports = (common) => {
60
61
factory . spawnNode ( ( err , node ) => {
61
62
expect ( err ) . to . not . exist ( )
62
63
ipfs = node
63
- done ( )
64
+ node . id ( ( err , id ) => {
65
+ expect ( err ) . to . not . exist ( )
66
+ withGo = id . agentVersion . startsWith ( 'go-ipfs' )
67
+ done ( )
68
+ } )
64
69
} )
65
70
} )
66
71
} )
@@ -980,5 +985,31 @@ module.exports = (common) => {
980
985
)
981
986
} )
982
987
} )
988
+
989
+ describe ( '.stat' , ( ) => {
990
+ before ( ( done ) => ipfs . files . add ( smallFile . data , done ) )
991
+
992
+ it ( 'stat outside of mfs' , function ( done ) {
993
+ if ( ! withGo ) {
994
+ console . log ( 'Not supported in js-ipfs yet' )
995
+ this . skip ( )
996
+ }
997
+
998
+ ipfs . files . stat ( '/ipfs/' + smallFile . cid , ( err , stat ) => {
999
+ expect ( err ) . to . not . exist ( )
1000
+ expect ( stat ) . to . eql ( {
1001
+ type : 'file' ,
1002
+ blocks : 0 ,
1003
+ size : 12 ,
1004
+ hash : 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP' ,
1005
+ cumulativeSize : 20 ,
1006
+ withLocality : false ,
1007
+ local : undefined ,
1008
+ sizeLocal : undefined
1009
+ } )
1010
+ done ( )
1011
+ } )
1012
+ } )
1013
+ } )
983
1014
} )
984
1015
}
You can’t perform that action at this time.
0 commit comments