This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree 2 files changed +25
-8
lines changed
2 files changed +25
-8
lines changed Original file line number Diff line number Diff line change 2
2
3
3
const promisify = require ( 'promisify-es6' )
4
4
5
+ const transform = function ( res , callback ) {
6
+ callback ( null , {
7
+ provideBufLen : res . ProvideBufLen ,
8
+ wantlist : res . Wantlist ,
9
+ peers : res . Peers ,
10
+ blocksReceived : res . BlocksReceived ,
11
+ dataReceived : res . DataReceived ,
12
+ blocksSent : res . BlocksSent ,
13
+ dataSent : res . DataSent ,
14
+ dupBlksReceived : res . DupBlksReceived ,
15
+ dupDataReceived : res . DupDataReceived
16
+ } )
17
+ }
18
+
5
19
module . exports = ( send ) => {
6
20
return promisify ( ( callback ) => {
7
- send ( {
21
+ send . andTransform ( {
8
22
path : 'bitswap/stat'
9
- } , callback )
23
+ } , transform , callback )
10
24
} )
11
25
}
Original file line number Diff line number Diff line change @@ -41,12 +41,15 @@ describe('.bitswap', function () {
41
41
it ( '.stat' , ( done ) => {
42
42
ipfs . bitswap . stat ( ( err , res ) => {
43
43
expect ( err ) . to . not . exist ( )
44
- expect ( res ) . to . have . property ( 'BlocksReceived' )
45
- expect ( res ) . to . have . property ( 'DupBlksReceived' )
46
- expect ( res ) . to . have . property ( 'DupDataReceived' )
47
- expect ( res ) . to . have . property ( 'Peers' )
48
- expect ( res ) . to . have . property ( 'ProvideBufLen' )
49
- expect ( res ) . to . have . property ( 'Wantlist' )
44
+ expect ( res ) . to . have . a . property ( 'provideBufLen' )
45
+ expect ( res ) . to . have . a . property ( 'wantlist' )
46
+ expect ( res ) . to . have . a . property ( 'peers' )
47
+ expect ( res ) . to . have . a . property ( 'blocksReceived' )
48
+ expect ( res ) . to . have . a . property ( 'dataReceived' )
49
+ expect ( res ) . to . have . a . property ( 'blocksSent' )
50
+ expect ( res ) . to . have . a . property ( 'dataSent' )
51
+ expect ( res ) . to . have . a . property ( 'dupBlksReceived' )
52
+ expect ( res ) . to . have . a . property ( 'dupDataReceived' )
50
53
51
54
done ( )
52
55
} )
You can’t perform that action at this time.
0 commit comments