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

Commit e326540

Browse files
committed
test: use StandaloneDaemon in test/http-api
This replaces durect use of HttpApi with StandaloneDaemon, restoring all existing tests to operational state. License: MIT Signed-off-by: Marcin Rataj <[email protected]>
1 parent 0b9076d commit e326540

17 files changed

+18
-18
lines changed

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._apiServers[0]
15+
api = http.api._httpApi._apiServers[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._apiServers[0]
16+
api = http.api._httpApi._apiServers[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._apiServers[0]
14+
api = http.api._httpApi._apiServers[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._apiServers[0]
20+
api = http.api._httpApi._apiServers[0]
2121
})
2222

2323
after(() => {

test/http-api/inject/dag.js

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

3535
before(() => {
36-
api = http.api._apiServers[0]
36+
api = http.api._httpApi._apiServers[0]
3737
})
3838

3939
describe('/dag/get', () => {

test/http-api/inject/dht.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._apiServers[0]
15+
api = http.api._httpApi._apiServers[0]
1616
})
1717

1818
describe('/findpeer', () => {

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._apiServers[0]
11+
api = http.api._httpApi._apiServers[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._apiServers[0]
16+
api = http.api._httpApi._apiServers[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._apiServers[0]
11+
api = http.api._httpApi._apiServers[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._apiServers[0]
19+
api = http.api._httpApi._apiServers[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._apiServers[0]
20+
api = http.api._httpApi._apiServers[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._apiServers[0]
40+
api = http.api._httpApi._apiServers[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._apiServers[0]
16+
api = http.api._httpApi._apiServers[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._apiServers[0]
19+
api = http.api._httpApi._apiServers[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._apiServers[0]
15+
api = http.api._httpApi._apiServers[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._apiServers[0]
12+
api = http.api._httpApi._apiServers[0]
1313
})
1414

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

test/http-api/routes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const chai = require('chai')
66
const dirtyChai = require('dirty-chai')
77
chai.use(dirtyChai)
88
const hat = require('hat')
9-
const API = require('../../src/http/index')
9+
const StandaloneDaemon = require('../../src/cli/standalone-daemon')
1010
const promisify = require('promisify-es6')
1111
const ncp = promisify(require('ncp').ncp)
1212
const path = require('path')
@@ -22,7 +22,7 @@ describe('HTTP API', () => {
2222
let http = {}
2323

2424
const startHttpAPI = async (config) => {
25-
http.api = new API({
25+
http.api = new StandaloneDaemon({
2626
repo: repoTests,
2727
pass: hat(),
2828
config,

0 commit comments

Comments
 (0)