@@ -11,6 +11,7 @@ chai.use(dirtyChai)
11
11
module . exports = ( common ) => {
12
12
describe ( '.stats' , ( ) => {
13
13
let ipfs
14
+ let withGo
14
15
15
16
before ( function ( done ) {
16
17
// CI takes longer to instantiate the daemon, so we need to increase the
@@ -22,7 +23,11 @@ module.exports = (common) => {
22
23
factory . spawnNode ( ( err , node ) => {
23
24
expect ( err ) . to . not . exist ( )
24
25
ipfs = node
25
- done ( )
26
+ node . id ( ( err , id ) => {
27
+ expect ( err ) . to . not . exist ( )
28
+ withGo = id . agentVersion . startsWith ( 'go-ipfs' )
29
+ done ( )
30
+ } )
26
31
} )
27
32
} )
28
33
} )
@@ -32,6 +37,11 @@ module.exports = (common) => {
32
37
} )
33
38
34
39
it ( '.bitswap' , ( done ) => {
40
+ if ( ! withGo ) {
41
+ console . log ( 'Not supported in js-ipfs yet' )
42
+ return done ( )
43
+ }
44
+
35
45
ipfs . stats . bitswap ( ( err , res ) => {
36
46
expect ( err ) . to . not . exist ( )
37
47
expect ( res ) . to . exist ( )
@@ -49,6 +59,11 @@ module.exports = (common) => {
49
59
} )
50
60
51
61
it ( '.bitswap Promise' , ( ) => {
62
+ if ( ! withGo ) {
63
+ console . log ( 'Not supported in js-ipfs yet' )
64
+ return
65
+ }
66
+
52
67
return ipfs . stats . bitswap ( ) . then ( ( res ) => {
53
68
expect ( res ) . to . exist ( )
54
69
expect ( res ) . to . have . a . property ( 'provideBufLen' )
@@ -64,6 +79,11 @@ module.exports = (common) => {
64
79
} )
65
80
66
81
it ( '.bw' , ( done ) => {
82
+ if ( ! withGo ) {
83
+ console . log ( 'Not supported in js-ipfs yet' )
84
+ return done ( )
85
+ }
86
+
67
87
ipfs . stats . bw ( ( err , res ) => {
68
88
expect ( err ) . to . not . exist ( )
69
89
expect ( res ) . to . exist ( )
@@ -76,6 +96,11 @@ module.exports = (common) => {
76
96
} )
77
97
78
98
it ( '.bw Promise' , ( ) => {
99
+ if ( ! withGo ) {
100
+ console . log ( 'Not supported in js-ipfs yet' )
101
+ return
102
+ }
103
+
79
104
return ipfs . stats . bw ( ) . then ( ( res ) => {
80
105
expect ( res ) . to . exist ( )
81
106
expect ( res ) . to . have . a . property ( 'totalIn' )
@@ -86,6 +111,11 @@ module.exports = (common) => {
86
111
} )
87
112
88
113
it ( '.repo' , ( done ) => {
114
+ if ( ! withGo ) {
115
+ console . log ( 'Not supported in js-ipfs yet' )
116
+ return done ( )
117
+ }
118
+
89
119
ipfs . stats . repo ( ( err , res ) => {
90
120
expect ( err ) . to . not . exist ( )
91
121
expect ( res ) . to . exist ( )
@@ -99,6 +129,11 @@ module.exports = (common) => {
99
129
} )
100
130
101
131
it ( '.repo Promise' , ( ) => {
132
+ if ( ! withGo ) {
133
+ console . log ( 'Not supported in js-ipfs yet' )
134
+ return
135
+ }
136
+
102
137
return ipfs . stats . repo ( ) . then ( ( res ) => {
103
138
expect ( res ) . to . exist ( )
104
139
expect ( res ) . to . have . a . property ( 'numObjects' )
0 commit comments