This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -41,5 +41,34 @@ module.exports = (createCommon, options) => {
41
41
expectIsBitswap ( null , res )
42
42
} )
43
43
} )
44
+
45
+ it ( 'should get human readable bitswap stats' , async ( ) => {
46
+ const stats = await ipfs . stats . bitswap ( { human : true } )
47
+
48
+ expect ( stats ) . to . exist ( )
49
+ expect ( stats ) . to . have . a . property ( 'provideBufLen' )
50
+ . and . to . be . a ( 'number' )
51
+ expect ( stats ) . to . have . a . property ( 'blocksReceived' )
52
+ . and . to . be . a ( 'number' )
53
+ expect ( stats ) . to . have . a . property ( 'wantlist' )
54
+ . and . to . be . a ( 'string' )
55
+ . and . to . match ( / \[ \d + \s k e y s \] $ / gm)
56
+ expect ( stats ) . to . have . a . property ( 'peers' )
57
+ . and . to . be . a ( 'string' )
58
+ . and . to . match ( / \[ \d + \] $ / gm)
59
+ expect ( stats ) . to . have . a . property ( 'dupBlksReceived' )
60
+ . and . to . be . a ( 'number' )
61
+ expect ( stats ) . to . have . a . property ( 'dupDataReceived' )
62
+ . and . to . be . a ( 'string' )
63
+ . and . to . match ( / [ \d . ] + \s [ P T G M K ] ? B $ / gm)
64
+ expect ( stats ) . to . have . a . property ( 'dataReceived' )
65
+ . and . to . be . a ( 'string' )
66
+ . and . to . match ( / [ \d . ] + \s [ P T G M K ] ? B $ / gm)
67
+ expect ( stats ) . to . have . a . property ( 'blocksSent' )
68
+ . and . to . be . a ( 'number' )
69
+ expect ( stats ) . to . have . a . property ( 'dataSent' )
70
+ . and . to . be . a ( 'string' )
71
+ . and . to . match ( / [ \d . ] + \s [ P T G M K ] ? B $ / gm)
72
+ } )
44
73
} )
45
74
}
You can’t perform that action at this time.
0 commit comments