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

Commit 2ff3e5c

Browse files
committed
fix: update to the latest ctl api
1 parent 3049136 commit 2ff3e5c

13 files changed

+38
-32
lines changed

test/commands.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ describe('.commands', function () {
1010
let ipfs
1111

1212
before(async () => {
13-
ipfs = await f.setup()
13+
ipfs = (await f.spawn()).api
1414
})
1515

16-
after(() => f.teardown())
16+
after(() => f.clean())
1717

1818
it('lists commands', async () => {
1919
const res = await ipfs.commands()

test/constructor.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ describe('ipfs-http-client constructor tests', () => {
9898
before(async function () {
9999
this.timeout(60 * 1000) // slow CI
100100

101-
ipfsd = await f.node()
101+
ipfsd = await f.spawn()
102102
})
103103

104-
after(() => ipfsd.stop())
104+
after(() => f.clean())
105105

106106
it('can connect to an ipfs http api', async () => {
107107
await clientWorks(ipfsClient(ipfsd.apiAddr))

test/dag.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ let ipfs
1313
describe('.dag', function () {
1414
this.timeout(20 * 1000)
1515
before(async function () {
16-
ipfs = await f.setup()
16+
ipfs = (await f.spawn()).api
1717
})
1818

19-
after(() => f.teardown())
19+
after(() => f.clean())
2020

2121
it('should be able to put and get a DAG node with format dag-pb', async () => {
2222
const data = Buffer.from('some data')

test/diag.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ describe('.diag', function () {
1414
let ipfs
1515

1616
before(async () => {
17-
ipfs = await f.setup()
17+
ipfs = (await f.spawn()).api
1818
})
1919

20-
after(() => f.teardown())
20+
after(() => f.clean())
2121

2222
describe('api API', () => {
2323
// Disabled in go-ipfs 0.4.10

test/files-mfs.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ describe('.files (the MFS API part)', function () {
3535
const expectedMultihash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'
3636

3737
before(async () => {
38-
ipfs = await f.setup()
38+
ipfs = (await f.spawn()).api
3939
})
4040

41-
after(() => f.teardown())
41+
after(() => f.clean())
4242

4343
it('.add file for testing', async () => {
4444
const res = await ipfs.add(testfile)

test/get.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ describe('.get (specific go-ipfs features)', function () {
2323
let ipfs
2424

2525
before(async () => {
26-
ipfs = await f.setup()
26+
ipfs = (await f.spawn()).api
2727
await ipfs.add(smallFile.data)
2828
})
2929

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

3232
it('no compression args', async () => {
3333
const files = await ipfs.get(smallFile.cid)

test/interface.spec.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,26 @@
44
const tests = require('interface-ipfs-core')
55
const merge = require('merge-options')
66
const { isNode } = require('ipfs-utils/src/env')
7-
const { createTestsInterface } = require('ipfsd-ctl')
7+
const { createFactory } = require('ipfsd-ctl')
8+
const { findBin } = require('ipfsd-ctl/src/utils')
89
const isWindows = process.platform && process.platform === 'win32'
910

11+
/** @typedef {import("ipfsd-ctl").ControllerOptions} ControllerOptions */
12+
1013
describe('interface-ipfs-core tests', () => {
14+
/** @type ControllerOptions */
1115
const commonOptions = {
16+
test: true,
1217
ipfsHttp: {
1318
path: require.resolve('../src'),
1419
ref: require('../src')
1520
},
1621
ipfsOptions: {
1722
pass: 'ipfs-is-awesome-software'
18-
}
23+
},
24+
ipfsBin: findBin('go')
1925
}
20-
const commonFactory = createTestsInterface(commonOptions)
26+
const commonFactory = createFactory(commonOptions)
2127

2228
tests.bitswap(commonFactory)
2329

@@ -152,7 +158,7 @@ describe('interface-ipfs-core tests', () => {
152158

153159
tests.miscellaneous(commonFactory)
154160

155-
tests.name(createTestsInterface(merge(commonOptions,
161+
tests.name(createFactory(merge(commonOptions,
156162
{
157163
ipfsOptions: {
158164
offline: true
@@ -168,7 +174,7 @@ describe('interface-ipfs-core tests', () => {
168174
]
169175
})
170176

171-
tests.namePubsub(createTestsInterface(merge(commonOptions,
177+
tests.namePubsub(createFactory(merge(commonOptions,
172178
{
173179
ipfsOptions: {
174180
EXPERIMENTAL: {
@@ -212,7 +218,7 @@ describe('interface-ipfs-core tests', () => {
212218
]
213219
})
214220

215-
tests.pubsub(createTestsInterface(merge(commonOptions,
221+
tests.pubsub(createFactory(merge(commonOptions,
216222
{
217223
args: ['--enable-pubsub-experiment']
218224
}

test/key.spec.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-env mocha */
2-
/* eslint max-nested-callbacks: ["error", 8] */
32
'use strict'
43

54
const { expect } = require('interface-ipfs-core/src/utils/mocha')
@@ -11,10 +10,10 @@ describe('.key', function () {
1110
let ipfs
1211

1312
before(async () => {
14-
ipfs = await f.setup()
13+
ipfs = (await f.spawn()).api
1514
})
1615

17-
after(() => f.teardown())
16+
after(() => f.clean())
1817

1918
describe('.gen', () => {
2019
it('create a new rsa key', async () => {

test/log.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ describe('.log', function () {
1111
let ipfs
1212

1313
before(async () => {
14-
ipfs = await f.setup()
14+
ipfs = (await f.spawn()).api
1515
})
1616

17-
after(() => f.teardown())
17+
after(() => f.clean())
1818

1919
it('.log.tail', async () => {
2020
const i = setInterval(async () => {

test/ping.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ describe('.ping', function () {
2222
before(async function () {
2323
this.timeout(30 * 1000) // slow CI
2424

25-
ipfs = await f.setup()
26-
other = await f.setup()
25+
ipfs = (await f.spawn()).api
26+
other = (await f.spawn()).api
2727

2828
const ma = (await ipfs.id()).addresses[0]
2929
await other.swarm.connect(ma)
3030

3131
otherId = (await other.id()).id
3232
})
3333

34-
after(() => f.teardown())
34+
after(() => f.clean())
3535

3636
it('.ping with default count', async () => {
3737
const res = await ipfs.ping(otherId)

test/repo.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ describe('.repo', function () {
1010
let ipfs
1111

1212
before(async () => {
13-
ipfs = await f.setup()
13+
ipfs = (await f.spawn()).api
1414
})
1515

16-
after(() => f.teardown())
16+
after(() => f.clean())
1717

1818
it('.repo.gc', async () => {
1919
const res = await ipfs.repo.gc()

test/stats.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ describe('stats', function () {
1010
let ipfs
1111

1212
before(async () => {
13-
ipfs = await f.setup()
13+
ipfs = (await f.spawn()).api
1414
})
1515

16-
after(() => f.teardown())
16+
after(() => f.clean())
1717

1818
it('.stats.bitswap', async () => {
1919
const res = await ipfs.stats.bitswap()

test/utils/factory.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
'use strict'
2-
const { createTestsInterface } = require('ipfsd-ctl')
2+
const { createFactory } = require('ipfsd-ctl')
33
const { findBin } = require('ipfsd-ctl/src/utils')
44

5-
const factory = createTestsInterface({
5+
const factory = createFactory({
6+
test: 'true',
67
type: 'go',
78
ipfsBin: findBin('go'),
89
ipfsHttp: {

0 commit comments

Comments
 (0)