Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 87918d7

Browse files
updating tests cases
1 parent 57bf1cf commit 87918d7

File tree

17 files changed

+23
-21
lines changed

17 files changed

+23
-21
lines changed

src/http/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,24 +109,24 @@ class HttpApi {
109109

110110
const apiAddrs = config.Addresses.API
111111

112-
this._apiServers = await Promise.resolve(
112+
this._apiServer = await Promise.resolve(
113113
serverCreator.apply(this, [apiAddrs, this._createApiServer, hapiInfoToMultiaddr, ipfs])
114114
)
115115
// for the CLI to know the where abouts of the API
116-
await promisify(ipfs._repo.apiAddr.set)(this._apiServers[0].info.ma)
116+
await promisify(ipfs._repo.apiAddr.set)(this._apiServer[0].info.ma)
117117

118118
const gatewayAddr = config.Addresses.Gateway
119119

120120
this._gatewayServer = await Promise.resolve(
121121
serverCreator.apply(this, [gatewayAddr, this._createGatewayServer, hapiInfoToMultiaddr, ipfs])
122122
)
123-
this._apiServers.forEach(apiServer => {
123+
this._apiServer.forEach(apiServer => {
124124
ipfs._print('API listening on %s', apiServer.info.ma)
125125
})
126126
this._gatewayServer.forEach(gatewayServer => {
127127
ipfs._print('Gateway (read only) listening on %s', gatewayServer.info.ma)
128128
})
129-
this._apiServers.forEach(apiServer => {
129+
this._apiServer.forEach(apiServer => {
130130
ipfs._print('Web UI available at %s', toUri(apiServer.info.ma) + '/webui')
131131
})
132132
this._log('started')
@@ -199,7 +199,7 @@ class HttpApi {
199199

200200
get apiAddr () {
201201
if (!this._apiServer) throw new Error('API address unavailable - server is not started')
202-
return multiaddr('/ip4/127.0.0.1/tcp/' + this._apiServers[0].info.port)
202+
return multiaddr('/ip4/127.0.0.1/tcp/' + this._apiServer[0].info.port)
203203
}
204204

205205
async stop () {

test/gateway/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('HTTP Gateway', function () {
6060

6161
await http.api.start()
6262

63-
gateway = http.api._gatewayServer
63+
gateway = http.api._gatewayServer[0]
6464

6565
// QmbQD7EMEL1zeebwBsWEfA3ndgSS6F7S6iTuwuqasPgVRi
6666
await http.api._ipfs.add([

test/http-api/inject/bitswap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = (http) => {
1212
let api
1313

1414
before(() => {
15-
api = http.api._apiServer
15+
api = http.api._apiServer[0]
1616
})
1717

1818
before(async function () {

test/http-api/inject/block.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = (http) => {
1313
let api
1414

1515
before(() => {
16-
api = http.api._apiServer
16+
api = http.api._apiServer[0]
1717
})
1818

1919
describe('/block/put', () => {

test/http-api/inject/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = (http) => {
1111
let api
1212

1313
before(() => {
14-
api = http.api._apiServer
14+
api = http.api._apiServer[0]
1515
return api.inject({
1616
method: 'GET',
1717
url: '/api/v0/bootstrap/add/default'

test/http-api/inject/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = (http) => {
1717

1818
before(() => {
1919
updatedConfig = () => JSON.parse(fs.readFileSync(configPath, 'utf8'))
20-
api = http.api._apiServer
20+
api = http.api._apiServer[0]
2121
})
2222

2323
after(() => {

test/http-api/inject/dht.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ chai.use(dirtyChai)
1010
module.exports = (http) => {
1111
describe('/dht', () => {
1212
let api
13+
1314
before(() => {
14-
api = http.api._apiServer
15+
api = http.api._apiServer[0]
1516
})
1617

1718
describe('/findpeer', () => {
@@ -20,6 +21,7 @@ module.exports = (http) => {
2021
method: 'GET',
2122
url: `/api/v0/dht/findpeer`
2223
})
24+
2325
expect(res.statusCode).to.equal(400)
2426
expect(res.result.Code).to.be.eql(1)
2527
})

test/http-api/inject/dns.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = (http) => {
88
let api
99

1010
before(() => {
11-
api = http.api._apiServer
11+
api = http.api._apiServer[0]
1212
})
1313

1414
it('resolve ipfs.io dns', async () => {

test/http-api/inject/files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = (http) => {
1313
let api
1414

1515
before(() => {
16-
api = http.api._apiServer
16+
api = http.api._apiServer[0]
1717
})
1818

1919
describe('/add', () => {

test/http-api/inject/id.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = (http) => {
88
let api
99

1010
before(() => {
11-
api = http.api._apiServer
11+
api = http.api._apiServer[0]
1212
})
1313

1414
it('get the id', async () => {

test/http-api/inject/name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = (http) => {
1616
let api
1717

1818
before(() => {
19-
api = http.api._apiServer
19+
api = http.api._apiServer[0]
2020
})
2121

2222
it('should publish a record', async function () {

test/http-api/inject/object.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = (http) => {
1717
let api
1818

1919
before('api', () => {
20-
api = http.api._apiServer
20+
api = http.api._apiServer[0]
2121
})
2222

2323
describe('/new', () => {

test/http-api/inject/pin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = (http) => {
3737
let api
3838

3939
before(() => {
40-
api = http.api._apiServer
40+
api = http.api._apiServer[0]
4141
})
4242

4343
describe('rm', () => {

test/http-api/inject/ping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = (http) => {
1313
let api
1414

1515
before(() => {
16-
api = http.api._apiServer
16+
api = http.api._apiServer[0]
1717
})
1818

1919
it('returns 400 if both n and count are provided', async () => {

test/http-api/inject/pubsub.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = (http) => {
1616
const topicNotSubscribed = 'somethingRandom'
1717

1818
before(() => {
19-
api = http.api._apiServer
19+
api = http.api._apiServer[0]
2020
})
2121

2222
describe('/sub', () => {

test/http-api/inject/resolve.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = (http) => {
1212
let api
1313

1414
before(() => {
15-
api = http.api._apiServer
15+
api = http.api._apiServer[0]
1616
})
1717

1818
it('should resolve a path and return a base2 encoded CID', async () => {

test/http-api/inject/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = (http) => {
99
let api
1010

1111
before(() => {
12-
api = http.api._apiServer
12+
api = http.api._apiServer[0]
1313
})
1414

1515
it('get the version', async () => {

0 commit comments

Comments
 (0)