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

Commit 4f39db8

Browse files
committed
feat: stardust4ipfs tests
1 parent 95a96ad commit 4f39db8

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@
213213
"qs": "^6.5.2",
214214
"rimraf": "^3.0.0",
215215
"sinon": "^7.4.2",
216+
"stardust4ipfs": "^0.1.2",
216217
"stream-to-promise": "^2.2.0",
217218
"temp-write": "^4.0.0"
218219
},

src/core/runtime/libp2p-browser.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const KadDHT = require('libp2p-kad-dht')
99
const GossipSub = require('libp2p-gossipsub')
1010
const libp2p = require('libp2p')
1111
const mergeOptions = require('merge-options')
12-
const multiaddr = require('multiaddr')
1312

1413
class Node extends libp2p {
1514
constructor (_options) {
@@ -26,8 +25,7 @@ class Node extends libp2p {
2625
modules: {
2726
transport: [
2827
WS,
29-
wrtcstar,
30-
wsstar
28+
wrtcstar
3129
],
3230
streamMuxer: [
3331
Multiplex

test/core/libp2p.spec.js

+27-2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,31 @@ describe('libp2p customization', function () {
107107
done()
108108
})
109109
})
110+
111+
it('should allow for custom overrideFunction', (done) => {
112+
const ipfs = {
113+
_repo: {
114+
datastore
115+
},
116+
_peerInfo: peerInfo,
117+
_peerBook: peerBook,
118+
// eslint-disable-next-line no-console
119+
_print: console.log,
120+
_options: {
121+
libp2p: {
122+
overrideFunction: require('stardust4ipfs')
123+
}
124+
}
125+
}
126+
127+
_libp2p = libp2pComponent(ipfs, testConfig)
128+
129+
_libp2p.start((err) => {
130+
expect(err).to.not.exist()
131+
expect(_libp2p._transport).to.have.length(3)
132+
done()
133+
})
134+
})
110135
})
111136

112137
describe('options', () => {
@@ -149,13 +174,13 @@ describe('libp2p customization', function () {
149174
strictSigning: true
150175
}
151176
})
152-
expect(_libp2p._transport).to.have.length(3)
177+
expect(_libp2p._transport).to.have.length(2)
153178
done()
154179
})
155180
})
156181

157182
it('should allow for overriding via options', (done) => {
158-
const wsstar = new WebSocketStar({ id: peerInfo.id })
183+
const wsstar = new Stardust({ id: peerInfo.id })
159184

160185
const ipfs = {
161186
_repo: {

0 commit comments

Comments
 (0)