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

Commit 8d89bb9

Browse files
committed
chore: update to the latest ctl api
1 parent d9c2aeb commit 8d89bb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+441
-439
lines changed

src/bitswap/stat.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
const { getDescribe, getIt, expect } = require('../utils/mocha')
55
const { expectIsBitswap } = require('../stats/utils')
66

7-
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
7+
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
88
/**
9-
* @param {TestsInterface} common
9+
* @param {Factory} common
1010
* @param {Object} options
1111
*/
1212
module.exports = (common, options) => {
@@ -17,18 +17,18 @@ module.exports = (common, options) => {
1717
this.timeout(60 * 1000)
1818
let ipfs
1919
before(async () => {
20-
ipfs = await common.setup()
20+
ipfs = (await common.spawn()).api
2121
})
2222

23-
after(() => common.teardown())
23+
after(() => common.clean())
2424

2525
it('should get bitswap stats', async () => {
2626
const res = await ipfs.bitswap.stat()
2727
expectIsBitswap(null, res)
2828
})
2929

3030
it('should not get bitswap stats when offline', async () => {
31-
const node = await common.node()
31+
const node = await common.spawn()
3232
await node.stop()
3333

3434
return expect(node.api.bitswap.stat()).to.eventually.be.rejected()

src/bitswap/wantlist.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
const { getDescribe, getIt, expect } = require('../utils/mocha')
55
const { waitForWantlistKey } = require('./utils')
66

7-
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
7+
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
88
/**
9-
* @param {TestsInterface} common
9+
* @param {Factory} common
1010
* @param {Object} options
1111
*/
1212
module.exports = (common, options) => {
@@ -20,14 +20,14 @@ module.exports = (common, options) => {
2020
const key = 'QmUBdnXXPyoDFXj3Hj39dNJ5VkN3QFRskXxcGaYFBB8CNR'
2121

2222
before(async () => {
23-
ipfsA = await common.setup()
24-
ipfsB = await common.setup({ type: 'go' })
23+
ipfsA = (await common.spawn()).api
24+
ipfsB = (await common.spawn({ type: 'go' })).api
2525
// Add key to the wantlist for ipfsB
2626
ipfsB.block.get(key, () => {})
2727
await ipfsA.swarm.connect(ipfsB.peerId.addresses[0])
2828
})
2929

30-
after(() => common.teardown())
30+
after(() => common.clean())
3131

3232
it('should get the wantlist', () => {
3333
return waitForWantlistKey(ipfsB, key)
@@ -38,7 +38,7 @@ module.exports = (common, options) => {
3838
})
3939

4040
it('should not get the wantlist when offline', async () => {
41-
const node = await common.node()
41+
const node = await common.spawn()
4242
await node.stop()
4343

4444
return expect(node.api.bitswap.stat()).to.eventually.be.rejected()

src/block/get.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ const multihash = require('multihashes')
55
const CID = require('cids')
66
const { getDescribe, getIt, expect } = require('../utils/mocha')
77

8-
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
8+
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
99
/**
10-
* @param {TestsInterface} common
10+
* @param {Factory} common
1111
* @param {Object} options
1212
*/
1313
module.exports = (common, options) => {
@@ -20,12 +20,12 @@ module.exports = (common, options) => {
2020
let ipfs, hash
2121

2222
before(async () => {
23-
ipfs = await common.setup()
23+
ipfs = (await common.spawn()).api
2424
const block = await ipfs.block.put(data)
2525
hash = block.cid.multihash
2626
})
2727

28-
after(() => common.teardown())
28+
after(() => common.clean())
2929

3030
it('should get by CID object', async () => {
3131
const cid = new CID(hash)

src/block/put.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const multihash = require('multihashes')
66
const CID = require('cids')
77
const { getDescribe, getIt, expect } = require('../utils/mocha')
88

9-
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
9+
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
1010
/**
11-
* @param {TestsInterface} common
11+
* @param {Factory} common
1212
* @param {Object} options
1313
*/
1414
module.exports = (common, options) => {
@@ -20,10 +20,10 @@ module.exports = (common, options) => {
2020
let ipfs
2121

2222
before(async () => {
23-
ipfs = await common.setup()
23+
ipfs = (await common.spawn()).api
2424
})
2525

26-
after(() => common.teardown())
26+
after(() => common.clean())
2727

2828
it('should put a buffer, using defaults', async () => {
2929
const expectedHash = 'QmPv52ekjS75L4JmHpXVeuJ5uX2ecSfSZo88NSyxwA3rAQ'

src/block/rm.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
const { getDescribe, getIt, expect } = require('../utils/mocha')
55
const hat = require('hat')
66

7-
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
7+
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
88
/**
9-
* @param {TestsInterface} common
9+
* @param {Factory} common
1010
* @param {Object} options
1111
*/
1212
module.exports = (common, options) => {
@@ -17,9 +17,9 @@ module.exports = (common, options) => {
1717
this.timeout(60 * 1000)
1818
let ipfs
1919

20-
before(async () => { ipfs = await common.setup() })
20+
before(async () => { ipfs = (await common.spawn()).api })
2121

22-
after(() => common.teardown())
22+
after(() => common.clean())
2323

2424
it('should remove by CID object', async () => {
2525
const cid = await ipfs.dag.put(Buffer.from(hat()), {

src/block/stat.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
const CID = require('cids')
55
const { getDescribe, getIt, expect } = require('../utils/mocha')
66

7-
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
7+
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
88
/**
9-
* @param {TestsInterface} common
9+
* @param {Factory} common
1010
* @param {Object} options
1111
*/
1212
module.exports = (common, options) => {
@@ -19,12 +19,12 @@ module.exports = (common, options) => {
1919
let ipfs, hash
2020

2121
before(async () => {
22-
ipfs = await common.setup()
22+
ipfs = (await common.spawn()).api
2323
const block = await ipfs.block.put(data)
2424
hash = block.cid.multihash
2525
})
2626

27-
after(() => common.teardown())
27+
after(() => common.clean())
2828

2929
it('should stat by CID', async () => {
3030
const cid = new CID(hash)

src/bootstrap/add.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha')
66
const invalidArg = 'this/Is/So/Invalid/'
77
const validIp4 = '/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z'
88

9-
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
9+
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
1010
/**
11-
* @param {TestsInterface} common
11+
* @param {Factory} common
1212
* @param {Object} options
1313
*/
1414
module.exports = (common, options) => {
@@ -21,10 +21,10 @@ module.exports = (common, options) => {
2121
let ipfs
2222

2323
before(async () => {
24-
ipfs = await common.setup()
24+
ipfs = (await common.spawn()).api
2525
})
2626

27-
after(() => common.teardown())
27+
after(() => common.clean())
2828

2929
it('should return an error when called with an invalid arg', () => {
3030
return expect(ipfs.bootstrap.add(invalidArg)).to.eventually.be.rejected

src/bootstrap/list.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
const { getDescribe, getIt, expect } = require('../utils/mocha')
55

6-
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
6+
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
77
/**
8-
* @param {TestsInterface} common
8+
* @param {Factory} common
99
* @param {Object} options
1010
*/
1111
module.exports = (common, options) => {
@@ -17,9 +17,9 @@ module.exports = (common, options) => {
1717

1818
let ipfs
1919

20-
before(async () => { ipfs = await common.setup() })
20+
before(async () => { ipfs = (await common.spawn()).api })
2121

22-
after(() => common.teardown())
22+
after(() => common.clean())
2323

2424
it('should return a list of peers', async () => {
2525
const res = await ipfs.bootstrap.list()

src/bootstrap/rm.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
const { getDescribe, getIt, expect } = require('../utils/mocha')
55

6-
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
6+
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
77
/**
8-
* @param {TestsInterface} common
8+
* @param {Factory} common
99
* @param {Object} options
1010
*/
1111
module.exports = (common, options) => {
@@ -20,9 +20,9 @@ module.exports = (common, options) => {
2020

2121
let ipfs
2222

23-
before(async () => { ipfs = await common.setup() })
23+
before(async () => { ipfs = (await common.spawn()).api })
2424

25-
after(() => common.teardown())
25+
after(() => common.clean())
2626

2727
it('should return an error when called with an invalid arg', () => {
2828
return expect(ipfs.bootstrap.rm(invalidArg)).to.eventually.be.rejected

src/config/get.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
const { getDescribe, getIt, expect } = require('../utils/mocha')
55
const isPlainObject = require('is-plain-object')
66

7-
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
7+
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
88
/**
9-
* @param {TestsInterface} common
9+
* @param {Factory} common
1010
* @param {Object} options
1111
*/
1212
module.exports = (common, options) => {
@@ -17,9 +17,9 @@ module.exports = (common, options) => {
1717
this.timeout(60 * 1000)
1818
let ipfs
1919

20-
before(async () => { ipfs = await common.setup() })
20+
before(async () => { ipfs = (await common.spawn()).api })
2121

22-
after(() => common.teardown())
22+
after(() => common.clean())
2323

2424
it('should retrieve the whole config', async () => {
2525
const config = await ipfs.config.get()

0 commit comments

Comments
 (0)