This repository was archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 297
/
Copy pathdiag.spec.js
86 lines (73 loc) · 1.91 KB
/
diag.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* eslint-env mocha */
'use strict'
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const platform = require('browser-process-platform')
const ipfsClient = require('../src')
const f = require('./utils/factory')
describe('.diag', function () {
this.timeout(50 * 1000)
// go-ipfs does not support these on Windows
if (platform === 'win32') { return }
let ipfsd
let ipfs
before((done) => {
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
expect(err).to.not.exist()
ipfsd = _ipfsd
ipfs = ipfsClient(_ipfsd.apiAddr)
done()
})
})
after((done) => {
if (!ipfsd) return done()
ipfsd.stop(done)
})
describe('Callback API', () => {
// Disabled in go-ipfs 0.4.10
it.skip('.diag.net', (done) => {
ipfs.diag.net((err, res) => {
expect(err).to.not.exist()
expect(res).to.exist()
done()
})
})
it('.diag.sys', (done) => {
ipfs.diag.sys((err, res) => {
expect(err).to.not.exist()
expect(res).to.exist()
expect(res).to.have.a.property('memory')
expect(res).to.have.a.property('diskinfo')
done()
})
})
it('.diag.cmds', (done) => {
ipfs.diag.cmds((err, res) => {
expect(err).to.not.exist()
expect(res).to.exist()
done()
})
})
})
describe('Promise API', () => {
// Disabled in go-ipfs 0.4.10
it.skip('.diag.net', () => {
return ipfs.diag.net()
.then((res) => expect(res).to.exist())
})
it('.diag.sys', () => {
return ipfs.diag.sys()
.then((res) => {
expect(res).to.exist()
expect(res).to.have.a.property('memory')
expect(res).to.have.a.property('diskinfo')
})
})
it('.diag.cmds', () => {
return ipfs.diag.cmds()
.then((res) => expect(res).to.exist())
})
})
})