@@ -17,11 +17,13 @@ describe('.bootstrap', function () {
17
17
this . timeout ( 100 * 1000 )
18
18
19
19
let ipfsd
20
+ let ipfs
20
21
21
22
before ( ( done ) => {
22
23
df . spawn ( ( err , node ) => {
23
24
expect ( err ) . to . not . exist ( )
24
25
ipfsd = node
26
+ ipfs = node . api
25
27
done ( )
26
28
} )
27
29
} )
@@ -35,14 +37,14 @@ describe('.bootstrap', function () {
35
37
36
38
describe ( '.add' , ( ) => {
37
39
it ( 'returns an error when called with an invalid arg' , ( done ) => {
38
- ipfsd . api . bootstrap . add ( invalidArg , ( err ) => {
40
+ ipfs . bootstrap . add ( invalidArg , ( err ) => {
39
41
expect ( err ) . to . be . an . instanceof ( Error )
40
42
done ( )
41
43
} )
42
44
} )
43
45
44
46
it ( 'returns a list of containing the bootstrap peer when called with a valid arg (ip4)' , ( done ) => {
45
- ipfsd . api . bootstrap . add ( validIp4 , ( err , res ) => {
47
+ ipfs . bootstrap . add ( validIp4 , ( err , res ) => {
46
48
expect ( err ) . to . not . exist ( )
47
49
expect ( res ) . to . be . eql ( { Peers : [ validIp4 ] } )
48
50
peers = res . Peers
@@ -53,7 +55,7 @@ describe('.bootstrap', function () {
53
55
} )
54
56
55
57
it ( 'returns a list of bootstrap peers when called with the default option' , ( done ) => {
56
- ipfsd . api . bootstrap . add ( { default : true } , ( err , res ) => {
58
+ ipfs . bootstrap . add ( { default : true } , ( err , res ) => {
57
59
expect ( err ) . to . not . exist ( )
58
60
peers = res . Peers
59
61
expect ( peers ) . to . exist ( )
@@ -65,7 +67,7 @@ describe('.bootstrap', function () {
65
67
66
68
describe ( '.list' , ( ) => {
67
69
it ( 'returns a list of peers' , ( done ) => {
68
- ipfsd . api . bootstrap . list ( ( err , res ) => {
70
+ ipfs . bootstrap . list ( ( err , res ) => {
69
71
expect ( err ) . to . not . exist ( )
70
72
peers = res . Peers
71
73
expect ( peers ) . to . exist ( )
@@ -76,14 +78,14 @@ describe('.bootstrap', function () {
76
78
77
79
describe ( '.rm' , ( ) => {
78
80
it ( 'returns an error when called with an invalid arg' , ( done ) => {
79
- ipfsd . api . bootstrap . rm ( invalidArg , ( err ) => {
81
+ ipfs . bootstrap . rm ( invalidArg , ( err ) => {
80
82
expect ( err ) . to . be . an . instanceof ( Error )
81
83
done ( )
82
84
} )
83
85
} )
84
86
85
87
it ( 'returns empty list because no peers removed when called without an arg or options' , ( done ) => {
86
- ipfsd . api . bootstrap . rm ( null , ( err , res ) => {
88
+ ipfs . bootstrap . rm ( null , ( err , res ) => {
87
89
expect ( err ) . to . not . exist ( )
88
90
peers = res . Peers
89
91
expect ( peers ) . to . exist ( )
@@ -93,7 +95,7 @@ describe('.bootstrap', function () {
93
95
} )
94
96
95
97
it ( 'returns list containing the peer removed when called with a valid arg (ip4)' , ( done ) => {
96
- ipfsd . api . bootstrap . rm ( null , ( err , res ) => {
98
+ ipfs . bootstrap . rm ( null , ( err , res ) => {
97
99
expect ( err ) . to . not . exist ( )
98
100
peers = res . Peers
99
101
expect ( peers ) . to . exist ( )
@@ -103,7 +105,7 @@ describe('.bootstrap', function () {
103
105
} )
104
106
105
107
it ( 'returns list of all peers removed when all option is passed' , ( done ) => {
106
- ipfsd . api . bootstrap . rm ( null , { all : true } , ( err , res ) => {
108
+ ipfs . bootstrap . rm ( null , { all : true } , ( err , res ) => {
107
109
expect ( err ) . to . not . exist ( )
108
110
peers = res . Peers
109
111
expect ( peers ) . to . exist ( )
@@ -118,21 +120,21 @@ describe('.bootstrap', function () {
118
120
119
121
describe ( '.add' , ( ) => {
120
122
it ( 'returns an error when called without args or options' , ( ) => {
121
- return ipfsd . api . bootstrap . add ( null )
123
+ return ipfs . bootstrap . add ( null )
122
124
. catch ( ( err ) => {
123
125
expect ( err ) . to . be . an . instanceof ( Error )
124
126
} )
125
127
} )
126
128
127
129
it ( 'returns an error when called with an invalid arg' , ( ) => {
128
- return ipfsd . api . bootstrap . add ( invalidArg )
130
+ return ipfs . bootstrap . add ( invalidArg )
129
131
. catch ( ( err ) => {
130
132
expect ( err ) . to . be . an . instanceof ( Error )
131
133
} )
132
134
} )
133
135
134
136
it ( 'returns a list of peers when called with a valid arg (ip4)' , ( ) => {
135
- return ipfsd . api . bootstrap . add ( validIp4 )
137
+ return ipfs . bootstrap . add ( validIp4 )
136
138
. then ( ( res ) => {
137
139
expect ( res ) . to . be . eql ( { Peers : [ validIp4 ] } )
138
140
peers = res . Peers
@@ -142,7 +144,7 @@ describe('.bootstrap', function () {
142
144
} )
143
145
144
146
it ( 'returns a list of default peers when called with the default option' , ( ) => {
145
- return ipfsd . api . bootstrap . add ( null , { default : true } )
147
+ return ipfs . bootstrap . add ( null , { default : true } )
146
148
. then ( ( res ) => {
147
149
peers = res . Peers
148
150
expect ( peers ) . to . exist ( )
@@ -153,7 +155,7 @@ describe('.bootstrap', function () {
153
155
154
156
describe ( '.list' , ( ) => {
155
157
it ( 'returns a list of peers' , ( ) => {
156
- return ipfsd . api . bootstrap . list ( )
158
+ return ipfs . bootstrap . list ( )
157
159
. then ( ( res ) => {
158
160
peers = res . Peers
159
161
expect ( peers ) . to . exist ( )
@@ -163,14 +165,14 @@ describe('.bootstrap', function () {
163
165
164
166
describe ( '.rm' , ( ) => {
165
167
it ( 'returns an error when called with an invalid arg' , ( ) => {
166
- return ipfsd . api . bootstrap . rm ( invalidArg )
168
+ return ipfs . bootstrap . rm ( invalidArg )
167
169
. catch ( ( err ) => {
168
170
expect ( err ) . to . be . an . instanceof ( Error )
169
171
} )
170
172
} )
171
173
172
174
it ( 'returns empty list when called without an arg or options' , ( ) => {
173
- return ipfsd . api . bootstrap . rm ( null )
175
+ return ipfs . bootstrap . rm ( null )
174
176
. then ( ( res ) => {
175
177
peers = res . Peers
176
178
expect ( peers ) . to . exist ( )
@@ -179,7 +181,7 @@ describe('.bootstrap', function () {
179
181
} )
180
182
181
183
it ( 'returns list containing the peer removed when called with a valid arg (ip4)' , ( ) => {
182
- return ipfsd . api . bootstrap . rm ( null )
184
+ return ipfs . bootstrap . rm ( null )
183
185
. then ( ( res ) => {
184
186
peers = res . Peers
185
187
expect ( peers ) . to . exist ( )
@@ -188,7 +190,7 @@ describe('.bootstrap', function () {
188
190
} )
189
191
190
192
it ( 'returns list of all peers removed when all option is passed' , ( ) => {
191
- return ipfsd . api . bootstrap . rm ( null , { all : true } )
193
+ return ipfs . bootstrap . rm ( null , { all : true } )
192
194
. then ( ( res ) => {
193
195
peers = res . Peers
194
196
expect ( peers ) . to . exist ( )
0 commit comments