forked from ipfs-inactive/js-ipfs-http-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swarm.spec.js
67 lines (55 loc) · 1.42 KB
/
swarm.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
/* eslint-env mocha */
/* globals apiClients */
'use strict'
const expect = require('chai').expect
describe('.swarm', () => {
it('.swarm.peers', (done) => {
apiClients.a.swarm.peers((err, res) => {
expect(err).to.not.exist
expect(res.Strings).to.have.length.above(1)
done()
})
})
it('.swarm.connect', (done) => {
// Done in the 'before' segment
done()
})
it('.swarm.disconnect', (done) => {
// Done in the 'after' segment
done()
})
it('.swarm.addrs', (done) => {
apiClients.a.swarm.addrs((err, res) => {
expect(err).to.not.exist
expect(Object.keys(res.Addrs)).to.have.length.above(1)
done()
})
})
it('.swarm.localAddrs', (done) => {
apiClients.a.swarm.localAddrs((err, res) => {
expect(err).to.not.exist
expect(res.Strings).to.have.length.above(1)
done()
})
})
describe('promise', () => {
it('.swarm.peers', () => {
return apiClients.a.swarm.peers()
.then((res) => {
expect(res.Strings).to.have.length.above(1)
})
})
it('.swarm.addrs', () => {
return apiClients.a.swarm.addrs()
.then((res) => {
expect(Object.keys(res.Addrs)).to.have.length.above(1)
})
})
it('.swarm.localAddrs', () => {
return apiClients.a.swarm.localAddrs()
.then((res) => {
expect(res.Strings).to.have.length.above(1)
})
})
})
})