Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit c4934ca

Browse files
MichaelMuredaviddias
authored andcommitted
test: use mocha's skip for conditional tests (#233)
1 parent 5d63357 commit c4934ca

File tree

4 files changed

+92
-92
lines changed

4 files changed

+92
-92
lines changed

js/src/files-mfs.js

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ module.exports = (common) => {
3737
after((done) => common.teardown(done))
3838

3939
describe('.mkdir', function () {
40-
it('make directory on root', (done) => {
40+
it('make directory on root', function (done) {
4141
if (!withGo) {
4242
console.log('Not supported in js-ipfs yet')
43-
return done()
43+
this.skip()
4444
}
4545

4646
ipfs.files.mkdir('/test', (err) => {
@@ -49,10 +49,10 @@ module.exports = (common) => {
4949
})
5050
})
5151

52-
it('make directory and its parents', (done) => {
52+
it('make directory and its parents', function (done) {
5353
if (!withGo) {
5454
console.log('Not supported in js-ipfs yet')
55-
return done()
55+
this.skip()
5656
}
5757

5858
ipfs.files.mkdir('/test/lv1/lv2', { p: true }, (err) => {
@@ -61,10 +61,10 @@ module.exports = (common) => {
6161
})
6262
})
6363

64-
it('make already existent directory', (done) => {
64+
it('make already existent directory', function (done) {
6565
if (!withGo) {
6666
console.log('Not supported in js-ipfs yet')
67-
return done()
67+
this.skip()
6868
}
6969

7070
ipfs.files.mkdir('/', (err) => {
@@ -75,10 +75,10 @@ module.exports = (common) => {
7575
})
7676

7777
describe('.write', function () {
78-
it('expect error', (done) => {
78+
it('expect error', function (done) {
7979
if (!withGo) {
8080
console.log('Not supported in js-ipfs yet')
81-
return done()
81+
this.skip()
8282
}
8383

8484
ipfs.files.write('/test/a', Buffer.from('Hello, world!'), (err) => {
@@ -87,10 +87,10 @@ module.exports = (common) => {
8787
})
8888
})
8989

90-
it('expect no error', (done) => {
90+
it('expect no error', function (done) {
9191
if (!withGo) {
9292
console.log('Not supported in js-ipfs yet')
93-
return done()
93+
this.skip()
9494
}
9595

9696
ipfs.files.write('/test/a', Buffer.from('Hello, world!'), {create: true}, (err) => {
@@ -101,10 +101,10 @@ module.exports = (common) => {
101101
})
102102

103103
describe('.cp', function () {
104-
it('copy file, expect error', (done) => {
104+
it('copy file, expect error', function (done) {
105105
if (!withGo) {
106106
console.log('Not supported in js-ipfs yet')
107-
return done()
107+
this.skip()
108108
}
109109

110110
ipfs.files.cp(['/test/c', '/test/b'], (err) => {
@@ -113,10 +113,10 @@ module.exports = (common) => {
113113
})
114114
})
115115

116-
it('copy file, expect no error', (done) => {
116+
it('copy file, expect no error', function (done) {
117117
if (!withGo) {
118118
console.log('Not supported in js-ipfs yet')
119-
return done()
119+
this.skip()
120120
}
121121

122122
ipfs.files.cp(['/test/a', '/test/b'], (err) => {
@@ -125,10 +125,10 @@ module.exports = (common) => {
125125
})
126126
})
127127

128-
it('copy dir, expect error', (done) => {
128+
it('copy dir, expect error', function (done) {
129129
if (!withGo) {
130130
console.log('Not supported in js-ipfs yet')
131-
return done()
131+
this.skip()
132132
}
133133

134134
ipfs.files.cp(['/test/lv1/lv3', '/test/lv1/lv4'], (err) => {
@@ -137,10 +137,10 @@ module.exports = (common) => {
137137
})
138138
})
139139

140-
it('copy dir, expect no error', (done) => {
140+
it('copy dir, expect no error', function (done) {
141141
if (!withGo) {
142142
console.log('Not supported in js-ipfs yet')
143-
return done()
143+
this.skip()
144144
}
145145

146146
ipfs.files.cp(['/test/lv1/lv2', '/test/lv1/lv3'], (err) => {
@@ -151,10 +151,10 @@ module.exports = (common) => {
151151
})
152152

153153
describe('.mv', function () {
154-
it('move file, expect error', (done) => {
154+
it('move file, expect error', function (done) {
155155
if (!withGo) {
156156
console.log('Not supported in js-ipfs yet')
157-
return done()
157+
this.skip()
158158
}
159159

160160
ipfs.files.mv(['/test/404', '/test/a'], (err) => {
@@ -163,10 +163,10 @@ module.exports = (common) => {
163163
})
164164
})
165165

166-
it('move file, expect no error', (done) => {
166+
it('move file, expect no error', function (done) {
167167
if (!withGo) {
168168
console.log('Not supported in js-ipfs yet')
169-
return done()
169+
this.skip()
170170
}
171171

172172
ipfs.files.mv(['/test/a', '/test/c'], (err) => {
@@ -175,10 +175,10 @@ module.exports = (common) => {
175175
})
176176
})
177177

178-
it('move dir, expect error', (done) => {
178+
it('move dir, expect error', function (done) {
179179
if (!withGo) {
180180
console.log('Not supported in js-ipfs yet')
181-
return done()
181+
this.skip()
182182
}
183183

184184
ipfs.files.mv(['/test/lv1/404', '/test/lv1'], (err) => {
@@ -187,10 +187,10 @@ module.exports = (common) => {
187187
})
188188
})
189189

190-
it('move dir, expect no error', (done) => {
190+
it('move dir, expect no error', function (done) {
191191
if (!withGo) {
192192
console.log('Not supported in js-ipfs yet')
193-
return done()
193+
this.skip()
194194
}
195195

196196
ipfs.files.mv(['/test/lv1/lv2', '/test/lv1/lv4'], (err) => {
@@ -201,10 +201,10 @@ module.exports = (common) => {
201201
})
202202

203203
describe('.rm', function () {
204-
it('remove file, expect error', (done) => {
204+
it('remove file, expect error', function (done) {
205205
if (!withGo) {
206206
console.log('Not supported in js-ipfs yet')
207-
return done()
207+
this.skip()
208208
}
209209

210210
ipfs.files.rm('/test/a', (err) => {
@@ -213,10 +213,10 @@ module.exports = (common) => {
213213
})
214214
})
215215

216-
it('remove file, expect no error', (done) => {
216+
it('remove file, expect no error', function (done) {
217217
if (!withGo) {
218218
console.log('Not supported in js-ipfs yet')
219-
return done()
219+
this.skip()
220220
}
221221

222222
ipfs.files.rm('/test/c', (err) => {
@@ -225,10 +225,10 @@ module.exports = (common) => {
225225
})
226226
})
227227

228-
it('remove dir, expect error', (done) => {
228+
it('remove dir, expect error', function (done) {
229229
if (!withGo) {
230230
console.log('Not supported in js-ipfs yet')
231-
return done()
231+
this.skip()
232232
}
233233

234234
ipfs.files.rm('/test/lv1/lv4', (err) => {
@@ -237,10 +237,10 @@ module.exports = (common) => {
237237
})
238238
})
239239

240-
it('remove dir, expect no error', (done) => {
240+
it('remove dir, expect no error', function (done) {
241241
if (!withGo) {
242242
console.log('Not supported in js-ipfs yet')
243-
return done()
243+
this.skip()
244244
}
245245

246246
ipfs.files.rm('/test/lv1/lv4', {recursive: true}, (err) => {
@@ -251,10 +251,10 @@ module.exports = (common) => {
251251
})
252252

253253
describe('.stat', function () {
254-
it('stat not found, expect error', (done) => {
254+
it('stat not found, expect error', function (done) {
255255
if (!withGo) {
256256
console.log('Not supported in js-ipfs yet')
257-
return done()
257+
this.skip()
258258
}
259259

260260
ipfs.files.stat('/test/404', (err) => {
@@ -263,10 +263,10 @@ module.exports = (common) => {
263263
})
264264
})
265265

266-
it('stat file', (done) => {
266+
it('stat file', function (done) {
267267
if (!withGo) {
268268
console.log('Not supported in js-ipfs yet')
269-
return done()
269+
this.skip()
270270
}
271271

272272
ipfs.files.stat('/test/b', (err, stat) => {
@@ -282,10 +282,10 @@ module.exports = (common) => {
282282
})
283283
})
284284

285-
it('stat dir', (done) => {
285+
it('stat dir', function (done) {
286286
if (!withGo) {
287287
console.log('Not supported in js-ipfs yet')
288-
return done()
288+
this.skip()
289289
}
290290

291291
ipfs.files.stat('/test', (err, stat) => {
@@ -303,10 +303,10 @@ module.exports = (common) => {
303303
})
304304

305305
describe('.read', function () {
306-
it('read not found, expect error', (done) => {
306+
it('read not found, expect error', function (done) {
307307
if (!withGo) {
308308
console.log('Not supported in js-ipfs yet')
309-
return done()
309+
this.skip()
310310
}
311311

312312
ipfs.files.read('/test/404', (err, buf) => {
@@ -316,10 +316,10 @@ module.exports = (common) => {
316316
})
317317
})
318318

319-
it('read file', (done) => {
319+
it('read file', function (done) {
320320
if (!withGo) {
321321
console.log('Not supported in js-ipfs yet')
322-
return done()
322+
this.skip()
323323
}
324324

325325
ipfs.files.read('/test/b', (err, buf) => {
@@ -331,10 +331,10 @@ module.exports = (common) => {
331331
})
332332

333333
describe('.ls', function () {
334-
it('ls not found, expect error', (done) => {
334+
it('ls not found, expect error', function (done) {
335335
if (!withGo) {
336336
console.log('Not supported in js-ipfs yet')
337-
return done()
337+
this.skip()
338338
}
339339

340340
ipfs.files.ls('/test/404', (err, info) => {
@@ -344,10 +344,10 @@ module.exports = (common) => {
344344
})
345345
})
346346

347-
it('ls directory', (done) => {
347+
it('ls directory', function (done) {
348348
if (!withGo) {
349349
console.log('Not supported in js-ipfs yet')
350-
return done()
350+
this.skip()
351351
}
352352

353353
ipfs.files.ls('/test', (err, info) => {
@@ -360,10 +360,10 @@ module.exports = (common) => {
360360
})
361361
})
362362

363-
it('ls -l directory', (done) => {
363+
it('ls -l directory', function (done) {
364364
if (!withGo) {
365365
console.log('Not supported in js-ipfs yet')
366-
return done()
366+
this.skip()
367367
}
368368

369369
ipfs.files.ls('/test', { l: true }, (err, info) => {
@@ -388,10 +388,10 @@ module.exports = (common) => {
388388
})
389389

390390
describe('.flush', function () {
391-
it('flush not found, expect error', (done) => {
391+
it('flush not found, expect error', function (done) {
392392
if (!withGo) {
393393
console.log('Not supported in js-ipfs yet')
394-
return done()
394+
this.skip()
395395
}
396396

397397
ipfs.files.flush('/test/404', (err) => {
@@ -400,10 +400,10 @@ module.exports = (common) => {
400400
})
401401
})
402402

403-
it('flush root', (done) => {
403+
it('flush root', function (done) {
404404
if (!withGo) {
405405
console.log('Not supported in js-ipfs yet')
406-
return done()
406+
this.skip()
407407
}
408408

409409
ipfs.files.flush((err) => {
@@ -412,10 +412,10 @@ module.exports = (common) => {
412412
})
413413
})
414414

415-
it('flush specific dir', (done) => {
415+
it('flush specific dir', function (done) {
416416
if (!withGo) {
417417
console.log('Not supported in js-ipfs yet')
418-
return done()
418+
this.skip()
419419
}
420420

421421
ipfs.files.flush('/test', (err) => {

0 commit comments

Comments
 (0)