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

Commit 2c6d349

Browse files
hugomrdiasAlan Shaw
authored and
Alan Shaw
committed
refactor: use new ctl api (#2529)
* feat: support the new interface core tests setup * fix: fix key rename output * fix: skip troublesome test * fix: ipfsd-ctl args handling * fix: change http api interface-core tests to new setup * fix: add reason to skip * fix: make aegir tests setup async * fix: fix ctl setup * fix: add pass option * fix: interface and cli tests ported plus ipfs/js-ipfs#2625 * fix: support new ctl in core and http tests * fix: fix linter * chore: fix tests timeout * chore: fix tests timeout more * chore: fix webworker * chore: debug key exhcnage * chore: debug key exhcnage 2 * fix: key exchange fixed * fix: overrides correctly in pubsub tests * fix: refactor missing pieces and await clean in bitswap tests * fix: skip test that dont work in firefox * chore: bump chromedriver * fix: fix circuit relay example * fix: linter * fix: more examples
1 parent 842df14 commit 2c6d349

File tree

5 files changed

+64
-43
lines changed

5 files changed

+64
-43
lines changed

circuit-relaying/src/app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ document.addEventListener('DOMContentLoaded', async () => {
1515
const $room = document.querySelector('#room')
1616
const $roomId = document.querySelector('#room-id')
1717

18-
let roomName = `default`
18+
let roomName = 'default'
1919
const fragment = window.location.hash.substr(1)
2020
if (fragment) {
2121
roomName = fragment
@@ -68,7 +68,7 @@ document.addEventListener('DOMContentLoaded', async () => {
6868
$roomId.addEventListener('keyup', (event) => {
6969
const kp = event.keyCode || event.which
7070
if (kp === 13 && $roomId.value.length > 0) {
71-
let name = $roomId.value
71+
const name = $roomId.value
7272
$room.innerText = name
7373

7474
$room.setAttribute('style', 'display: inline')

circuit-relaying/test.js

+21-14
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ const os = require('os')
55
const path = require('path')
66
const execa = require('execa')
77
const delay = require('delay')
8-
const DaemonFactory = require('ipfsd-ctl')
9-
const df = DaemonFactory.create({
10-
type: 'js',
11-
exec: path.resolve(`${__dirname}/../../src/cli/bin.js`),
12-
IpfsClient: require('ipfs-http-client')
8+
const { createFactory } = require('ipfsd-ctl')
9+
const df = createFactory({
10+
ipfsModule: {
11+
path: require.resolve('../../src'),
12+
ref: require('../../src')
13+
},
14+
ipfsHttpModule: {
15+
path: require.resolve('ipfs-http-client'),
16+
ref: require('ipfs-http-client')
17+
}
1318
})
1419
const {
1520
startServer
@@ -38,19 +43,21 @@ async function testUI (url, relay, localPeerIdFile, remotePeerIdFile) {
3843

3944
async function runTest () {
4045
const ipfsd = await df.spawn({
41-
initOptions: { bits: 512 },
42-
config: {
43-
Addresses: {
44-
Swarm: [
45-
'/ip4/127.0.0.1/tcp/0/ws'
46-
]
47-
},
48-
Bootstrap: [],
46+
type: 'proc',
47+
test: true,
48+
ipfsOptions: {
4949
relay: {
5050
enabled: true,
5151
hop: {
5252
enabled: true
5353
}
54+
},
55+
config: {
56+
Addresses: {
57+
Swarm: [
58+
'/ip4/127.0.0.1/tcp/0/ws'
59+
]
60+
}
5461
}
5562
}
5663
})
@@ -116,7 +123,7 @@ module.exports[pkg.name] = function (browser) {
116123

117124
break
118125
} catch (err) {
119-
126+
// ignore
120127
}
121128

122129
await delay(1000)

exchange-files-in-browser/test.js

+24-14
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@ const path = require('path')
55
const os = require('os')
66
const execa = require('execa')
77
const delay = require('delay')
8-
const DaemonFactory = require('ipfsd-ctl')
9-
const df = DaemonFactory.create({
10-
type: 'js',
11-
exec: path.resolve(`${__dirname}/../../src/cli/bin.js`),
12-
IpfsClient: require('ipfs-http-client')
13-
})
8+
const { createFactory } = require('ipfsd-ctl')
9+
const df = createFactory({
10+
ipfsModule: {
11+
path: require.resolve('../../src'),
12+
ref: require('../../src')
13+
},
14+
ipfsHttpModule: {
15+
path: require.resolve('ipfs-http-client'),
16+
ref: require('ipfs-http-client')
17+
}
18+
}, {
19+
js: {
20+
ipfsBin: path.resolve(`${__dirname}/../../src/cli/bin.js`)
21+
}
22+
}
23+
)
1424
const {
1525
startServer
1626
} = require('../utils')
@@ -35,14 +45,14 @@ async function testUI (env) {
3545

3646
async function runTest () {
3747
const ipfsd = await df.spawn({
38-
initOptions: { bits: 512 },
39-
config: {
40-
Addresses: {
41-
Swarm: [
42-
'/ip4/127.0.0.1/tcp/0/ws'
43-
]
44-
},
45-
Bootstrap: []
48+
ipfsOptions: {
49+
config: {
50+
Addresses: {
51+
Swarm: [
52+
'/ip4/127.0.0.1/tcp/0/ws'
53+
]
54+
}
55+
}
4656
}
4757
})
4858

explore-ethereum-blockchain/test.js

+16-12
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@
22

33
const fs = require('fs-extra')
44
const path = require('path')
5-
const DaemonFactory = require('ipfsd-ctl')
6-
const df = DaemonFactory.create({
7-
type: 'proc',
8-
exec: require('../../')
5+
const { createFactory } = require('ipfsd-ctl')
6+
const df = createFactory({
7+
ipfsModule: {
8+
path: require.resolve('../../src'),
9+
ref: require('../../src')
10+
},
11+
ipfsHttpModule: {
12+
path: require.resolve('ipfs-http-client'),
13+
ref: require('ipfs-http-client')
14+
}
15+
}, {
16+
js: {
17+
ipfsBin: path.resolve(`${__dirname}/../../src/cli/bin.js`)
18+
}
919
})
1020

1121
async function runTest () {
1222
const ipfsd = await df.spawn({
13-
initOptions: { bits: 512 },
14-
config: {
15-
Addresses: {
16-
Swarm: []
17-
},
18-
Bootstrap: []
19-
},
20-
disposable: true
23+
type: 'proc',
24+
test: true
2125
})
2226

2327
const cids = []

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"license": "MIT",
1010
"dependencies": {
11-
"chromedriver": "^77.0.0",
11+
"chromedriver": "^79.0.0",
1212
"delay": "^4.1.0",
1313
"execa": "^3.2.0",
1414
"fs-extra": "^8.1.0",

0 commit comments

Comments
 (0)