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

Commit cd6e60e

Browse files
committed
fix: fix ctl setup
1 parent 8cab0c6 commit cd6e60e

File tree

2 files changed

+53
-40
lines changed

2 files changed

+53
-40
lines changed

test/core/interface.spec.js

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,26 @@ const merge = require('merge-options')
77
const ctl = require('ipfsd-ctl')
88
const IPFS = require('../../src')
99

10+
/** @ignore @typedef { import("ipfsd-ctl").FactoryOptions } FactoryOptions */
11+
1012
describe('interface-ipfs-core tests', function () {
13+
/** @type FactoryOptions */
1114
const commonOptions = {
12-
factoryOptions: {
13-
type: 'proc',
14-
exec: IPFS,
15-
IpfsClient: require('ipfs-http-client')
16-
}
15+
type: 'proc',
16+
ipfsApi: {
17+
path: require.resolve('../../src'),
18+
ref: IPFS
19+
},
20+
ipfsHttp: {
21+
path: require.resolve('ipfs-http-client'),
22+
ref: require('ipfs-http-client')
23+
},
24+
ipfsBin: './src/cli/bin.js'
1725
}
1826
const commonFactory = ctl.createTestsInterface(commonOptions)
1927

2028
tests.bitswap(commonFactory, {
21-
skip: !isNode ? true : [
29+
skip: [
2230
{
2331
name: 'should get the wantlist by peer ID for a diffreent node',
2432
reason: 'TODO: find the reason'
@@ -53,26 +61,29 @@ describe('interface-ipfs-core tests', function () {
5361
tests.filesMFS(commonFactory)
5462

5563
tests.key(ctl.createTestsInterface(merge(commonOptions, {
56-
spawnOptions: {
57-
args: ['--pass', 'ipfs-is-awesome-software']
64+
ipfsOptions: {
65+
pass: 'ipfs-is-awesome-software'
5866
}
5967
})))
6068

6169
tests.miscellaneous(ctl.createTestsInterface(merge(commonOptions, {
62-
spawnOptions: {
63-
args: ['--pass', 'ipfs-is-awesome-software', '--offline']
70+
ipfsOptions: {
71+
pass: 'ipfs-is-awesome-software'
6472
}
6573
})))
6674

6775
tests.name(ctl.createTestsInterface(merge(commonOptions, {
68-
spawnOptions: {
69-
args: ['--pass', 'ipfs-is-awesome-software', '--offline']
76+
ipfsOptions: {
77+
pass: 'ipfs-is-awesome-software',
78+
offline: true
7079
}
7180
})))
7281

7382
tests.namePubsub(ctl.createTestsInterface(merge(commonOptions, {
74-
spawnOptions: {
75-
args: ['--enable-namesys-pubsub']
83+
ipfsOptions: {
84+
EXPERIMENTAL: {
85+
ipnsPubsub: true
86+
}
7687
}
7788
})))
7889

@@ -87,21 +98,13 @@ describe('interface-ipfs-core tests', function () {
8798

8899
tests.pin(commonFactory)
89100

90-
tests.ping(commonFactory, {
91-
skip: isNode ? null : {
92-
reason: 'FIXME: ping implementation requires DHT'
93-
}
94-
})
101+
tests.ping(commonFactory)
95102

96-
tests.pubsub(commonFactory, {
97-
skip: isNode ? null : {
98-
reason: 'FIXME: disabled because no swarm addresses'
99-
}
100-
})
103+
tests.pubsub(commonFactory)
101104

102105
tests.repo(commonFactory)
103106

104107
tests.stats(commonFactory)
105108

106-
tests.swarm(commonFactory, { skip: !isNode })
109+
tests.swarm(commonFactory)
107110
})

test/http-api/interface.js

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,26 @@
22
'use strict'
33

44
const tests = require('interface-ipfs-core')
5-
const path = require('path')
65
const merge = require('merge-options')
76
const ctl = require('ipfsd-ctl')
7+
const IPFS = require('../../src')
8+
9+
/** @ignore @typedef { import("ipfsd-ctl").FactoryOptions } FactoryOptions */
810

911
describe('interface-ipfs-core over ipfs-http-client tests', function () {
1012
this.timeout(20000)
13+
/** @type FactoryOptions */
1114
const commonOptions = {
12-
factoryOptions: {
13-
type: 'js',
14-
exec: path.resolve(`${__dirname}/../../src/cli/bin.js`),
15-
IpfsClient: require('ipfs-http-client')
16-
}
15+
type: 'js',
16+
ipfsApi: {
17+
path: require.resolve('../../src'),
18+
ref: IPFS
19+
},
20+
ipfsHttp: {
21+
path: require.resolve('ipfs-http-client'),
22+
ref: require('ipfs-http-client')
23+
},
24+
ipfsBin: './src/cli/bin.js'
1725
}
1826
const commonFactory = ctl.createTestsInterface(commonOptions)
1927

@@ -46,27 +54,29 @@ describe('interface-ipfs-core over ipfs-http-client tests', function () {
4654
tests.filesMFS(commonFactory)
4755

4856
tests.key(ctl.createTestsInterface(merge(commonOptions, {
49-
spawnOptions: {
50-
args: ['--pass', 'ipfs-is-awesome-software'],
51-
initOptions: { bits: 512 }
57+
ipfsOptions: {
58+
pass: 'ipfs-is-awesome-software'
5259
}
5360
})))
5461

5562
tests.miscellaneous(ctl.createTestsInterface(merge(commonOptions, {
56-
spawnOptions: {
57-
args: ['--pass', 'ipfs-is-awesome-software', '--offline']
63+
ipfsOptions: {
64+
pass: 'ipfs-is-awesome-software'
5865
}
5966
})))
6067

6168
tests.name(ctl.createTestsInterface(merge(commonOptions, {
62-
spawnOptions: {
63-
args: ['--pass', 'ipfs-is-awesome-software', '--offline']
69+
ipfsOptions: {
70+
pass: 'ipfs-is-awesome-software',
71+
offline: true
6472
}
6573
})))
6674

6775
tests.namePubsub(ctl.createTestsInterface(merge(commonOptions, {
68-
spawnOptions: {
69-
args: ['--enable-namesys-pubsub']
76+
ipfsOptions: {
77+
EXPERIMENTAL: {
78+
ipnsPubsub: true
79+
}
7080
}
7181
})))
7282

0 commit comments

Comments
 (0)