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

Commit 453fdc7

Browse files
committed
fix: avoid too many changes
1 parent 30ab1b5 commit 453fdc7

14 files changed

+116
-116
lines changed

test/bitswap.spec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('.bitswap', function () {
2828

2929
describe('Callback API', () => {
3030
it('.wantlist', (done) => {
31-
ipfsd.api.bitswap.wantlist((err, res) => {
31+
ipfs.bitswap.wantlist((err, res) => {
3232
expect(err).to.not.exist()
3333
expect(res).to.have.to.be.eql({
3434
Keys: null
@@ -38,7 +38,7 @@ describe('.bitswap', function () {
3838
})
3939

4040
it('.stat', (done) => {
41-
ipfsd.api.bitswap.stat((err, res) => {
41+
ipfs.bitswap.stat((err, res) => {
4242
expect(err).to.not.exist()
4343
expect(res).to.have.property('BlocksReceived')
4444
expect(res).to.have.property('DupBlksReceived')
@@ -53,7 +53,7 @@ describe('.bitswap', function () {
5353

5454
it('.unwant', (done) => {
5555
const key = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'
56-
ipfsd.api.bitswap.unwant(key, (err) => {
56+
ipfs.bitswap.unwant(key, (err) => {
5757
expect(err).to.not.exist()
5858
done()
5959
})
@@ -62,7 +62,7 @@ describe('.bitswap', function () {
6262

6363
describe('Promise API', () => {
6464
it('.wantlist', () => {
65-
return ipfsd.api.bitswap.wantlist()
65+
return ipfs.bitswap.wantlist()
6666
.then((res) => {
6767
expect(res).to.have.to.be.eql({
6868
Keys: null
@@ -71,7 +71,7 @@ describe('.bitswap', function () {
7171
})
7272

7373
it('.stat', () => {
74-
return ipfsd.api.bitswap.stat()
74+
return ipfs.bitswap.stat()
7575
.then((res) => {
7676
expect(res).to.have.property('BlocksReceived')
7777
expect(res).to.have.property('DupBlksReceived')
@@ -84,7 +84,7 @@ describe('.bitswap', function () {
8484

8585
it('.unwant', () => {
8686
const key = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'
87-
return ipfsd.api.bitswap.unwant(key)
87+
return ipfs.bitswap.unwant(key)
8888
})
8989
})
9090
})

test/bootstrap.spec.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ describe('.bootstrap', function () {
3737

3838
describe('.add', () => {
3939
it('returns an error when called with an invalid arg', (done) => {
40-
ipfsd.api.bootstrap.add(invalidArg, (err) => {
40+
ipfs.bootstrap.add(invalidArg, (err) => {
4141
expect(err).to.be.an.instanceof(Error)
4242
done()
4343
})
4444
})
4545

4646
it('returns a list of containing the bootstrap peer when called with a valid arg (ip4)', (done) => {
47-
ipfsd.api.bootstrap.add(validIp4, (err, res) => {
47+
ipfs.bootstrap.add(validIp4, (err, res) => {
4848
expect(err).to.not.exist()
4949
expect(res).to.be.eql({ Peers: [validIp4] })
5050
peers = res.Peers
@@ -55,7 +55,7 @@ describe('.bootstrap', function () {
5555
})
5656

5757
it('returns a list of bootstrap peers when called with the default option', (done) => {
58-
ipfsd.api.bootstrap.add({ default: true }, (err, res) => {
58+
ipfs.bootstrap.add({ default: true }, (err, res) => {
5959
expect(err).to.not.exist()
6060
peers = res.Peers
6161
expect(peers).to.exist()
@@ -67,7 +67,7 @@ describe('.bootstrap', function () {
6767

6868
describe('.list', () => {
6969
it('returns a list of peers', (done) => {
70-
ipfsd.api.bootstrap.list((err, res) => {
70+
ipfs.bootstrap.list((err, res) => {
7171
expect(err).to.not.exist()
7272
peers = res.Peers
7373
expect(peers).to.exist()
@@ -78,14 +78,14 @@ describe('.bootstrap', function () {
7878

7979
describe('.rm', () => {
8080
it('returns an error when called with an invalid arg', (done) => {
81-
ipfsd.api.bootstrap.rm(invalidArg, (err) => {
81+
ipfs.bootstrap.rm(invalidArg, (err) => {
8282
expect(err).to.be.an.instanceof(Error)
8383
done()
8484
})
8585
})
8686

8787
it('returns empty list because no peers removed when called without an arg or options', (done) => {
88-
ipfsd.api.bootstrap.rm(null, (err, res) => {
88+
ipfs.bootstrap.rm(null, (err, res) => {
8989
expect(err).to.not.exist()
9090
peers = res.Peers
9191
expect(peers).to.exist()
@@ -95,7 +95,7 @@ describe('.bootstrap', function () {
9595
})
9696

9797
it('returns list containing the peer removed when called with a valid arg (ip4)', (done) => {
98-
ipfsd.api.bootstrap.rm(null, (err, res) => {
98+
ipfs.bootstrap.rm(null, (err, res) => {
9999
expect(err).to.not.exist()
100100
peers = res.Peers
101101
expect(peers).to.exist()
@@ -105,7 +105,7 @@ describe('.bootstrap', function () {
105105
})
106106

107107
it('returns list of all peers removed when all option is passed', (done) => {
108-
ipfsd.api.bootstrap.rm(null, { all: true }, (err, res) => {
108+
ipfs.bootstrap.rm(null, { all: true }, (err, res) => {
109109
expect(err).to.not.exist()
110110
peers = res.Peers
111111
expect(peers).to.exist()
@@ -120,21 +120,21 @@ describe('.bootstrap', function () {
120120

121121
describe('.add', () => {
122122
it('returns an error when called without args or options', () => {
123-
return ipfsd.api.bootstrap.add(null)
123+
return ipfs.bootstrap.add(null)
124124
.catch((err) => {
125125
expect(err).to.be.an.instanceof(Error)
126126
})
127127
})
128128

129129
it('returns an error when called with an invalid arg', () => {
130-
return ipfsd.api.bootstrap.add(invalidArg)
130+
return ipfs.bootstrap.add(invalidArg)
131131
.catch((err) => {
132132
expect(err).to.be.an.instanceof(Error)
133133
})
134134
})
135135

136136
it('returns a list of peers when called with a valid arg (ip4)', () => {
137-
return ipfsd.api.bootstrap.add(validIp4)
137+
return ipfs.bootstrap.add(validIp4)
138138
.then((res) => {
139139
expect(res).to.be.eql({ Peers: [validIp4] })
140140
peers = res.Peers
@@ -144,7 +144,7 @@ describe('.bootstrap', function () {
144144
})
145145

146146
it('returns a list of default peers when called with the default option', () => {
147-
return ipfsd.api.bootstrap.add(null, { default: true })
147+
return ipfs.bootstrap.add(null, { default: true })
148148
.then((res) => {
149149
peers = res.Peers
150150
expect(peers).to.exist()
@@ -155,7 +155,7 @@ describe('.bootstrap', function () {
155155

156156
describe('.list', () => {
157157
it('returns a list of peers', () => {
158-
return ipfsd.api.bootstrap.list()
158+
return ipfs.bootstrap.list()
159159
.then((res) => {
160160
peers = res.Peers
161161
expect(peers).to.exist()
@@ -165,14 +165,14 @@ describe('.bootstrap', function () {
165165

166166
describe('.rm', () => {
167167
it('returns an error when called with an invalid arg', () => {
168-
return ipfsd.api.bootstrap.rm(invalidArg)
168+
return ipfs.bootstrap.rm(invalidArg)
169169
.catch((err) => {
170170
expect(err).to.be.an.instanceof(Error)
171171
})
172172
})
173173

174174
it('returns empty list when called without an arg or options', () => {
175-
return ipfsd.api.bootstrap.rm(null)
175+
return ipfs.bootstrap.rm(null)
176176
.then((res) => {
177177
peers = res.Peers
178178
expect(peers).to.exist()
@@ -181,7 +181,7 @@ describe('.bootstrap', function () {
181181
})
182182

183183
it('returns list containing the peer removed when called with a valid arg (ip4)', () => {
184-
return ipfsd.api.bootstrap.rm(null)
184+
return ipfs.bootstrap.rm(null)
185185
.then((res) => {
186186
peers = res.Peers
187187
expect(peers).to.exist()
@@ -190,7 +190,7 @@ describe('.bootstrap', function () {
190190
})
191191

192192
it('returns list of all peers removed when all option is passed', () => {
193-
return ipfsd.api.bootstrap.rm(null, { all: true })
193+
return ipfs.bootstrap.rm(null, { all: true })
194194
.then((res) => {
195195
peers = res.Peers
196196
expect(peers).to.exist()

test/commands.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('.commands', function () {
2727
after((done) => ipfsd.stop(done))
2828

2929
it('lists commands', (done) => {
30-
ipfsd.api.commands((err, res) => {
30+
ipfs.commands((err, res) => {
3131
expect(err).to.not.exist()
3232
expect(res).to.exist()
3333
done()
@@ -36,7 +36,7 @@ describe('.commands', function () {
3636

3737
describe('promise', () => {
3838
it('lists commands', () => {
39-
return ipfsd.api.commands()
39+
return ipfs.commands()
4040
.then((res) => {
4141
expect(res).to.exist()
4242
})

test/diag.spec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ describe('.diag', function () {
3535
describe('Callback API', () => {
3636
// Disabled in go-ipfs 0.4.10
3737
it.skip('.diag.net', (done) => {
38-
ipfsd.api.diag.net((err, res) => {
38+
ipfs.diag.net((err, res) => {
3939
expect(err).to.not.exist()
4040
expect(res).to.exist()
4141
done()
4242
})
4343
})
4444

4545
it('.diag.sys', (done) => {
46-
ipfsd.api.diag.sys((err, res) => {
46+
ipfs.diag.sys((err, res) => {
4747
expect(err).to.not.exist()
4848
expect(res).to.exist()
4949
expect(res).to.have.a.property('memory')
@@ -53,7 +53,7 @@ describe('.diag', function () {
5353
})
5454

5555
it('.diag.cmds', (done) => {
56-
ipfsd.api.diag.cmds((err, res) => {
56+
ipfs.diag.cmds((err, res) => {
5757
expect(err).to.not.exist()
5858
expect(res).to.exist()
5959
done()
@@ -64,12 +64,12 @@ describe('.diag', function () {
6464
describe('Promise API', () => {
6565
// Disabled in go-ipfs 0.4.10
6666
it.skip('.diag.net', () => {
67-
return ipfsd.api.diag.net()
67+
return ipfs.diag.net()
6868
.then((res) => expect(res).to.exist())
6969
})
7070

7171
it('.diag.sys', () => {
72-
return ipfsd.api.diag.sys()
72+
return ipfs.diag.sys()
7373
.then((res) => {
7474
expect(res).to.exist()
7575
expect(res).to.have.a.property('memory')
@@ -78,7 +78,7 @@ describe('.diag', function () {
7878
})
7979

8080
it('.diag.cmds', () => {
81-
return ipfsd.api.diag.cmds()
81+
return ipfs.diag.cmds()
8282
.then((res) => expect(res).to.exist())
8383
})
8484
})

0 commit comments

Comments
 (0)