@libp2p/interface-compliance-tests 1.1.18 → 1.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/connection/connection.js +1 -1
- package/dist/src/connection/connection.js.map +1 -1
- package/dist/src/connection-encrypter/index.js +1 -1
- package/dist/src/connection-encrypter/index.js.map +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +30 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/mocks/upgrader.js +1 -1
- package/dist/src/mocks/upgrader.js.map +1 -1
- package/dist/src/peer-discovery/index.d.ts.map +1 -1
- package/dist/src/peer-discovery/index.js +12 -11
- package/dist/src/peer-discovery/index.js.map +1 -1
- package/dist/src/pubsub/api.js +1 -1
- package/dist/src/pubsub/api.js.map +1 -1
- package/dist/src/pubsub/connection-handlers.d.ts.map +1 -1
- package/dist/src/pubsub/connection-handlers.js +9 -15
- package/dist/src/pubsub/connection-handlers.js.map +1 -1
- package/dist/src/pubsub/emit-self.d.ts.map +1 -1
- package/dist/src/pubsub/emit-self.js +6 -5
- package/dist/src/pubsub/emit-self.js.map +1 -1
- package/dist/src/pubsub/messages.d.ts.map +1 -1
- package/dist/src/pubsub/messages.js +4 -3
- package/dist/src/pubsub/messages.js.map +1 -1
- package/dist/src/pubsub/multiple-nodes.d.ts.map +1 -1
- package/dist/src/pubsub/multiple-nodes.js +6 -5
- package/dist/src/pubsub/multiple-nodes.js.map +1 -1
- package/dist/src/pubsub/two-nodes.d.ts.map +1 -1
- package/dist/src/pubsub/two-nodes.js +4 -5
- package/dist/src/pubsub/two-nodes.js.map +1 -1
- package/dist/src/record/index.js +1 -1
- package/dist/src/record/index.js.map +1 -1
- package/dist/src/stream-muxer/base-test.js +1 -1
- package/dist/src/stream-muxer/base-test.js.map +1 -1
- package/dist/src/stream-muxer/close-test.js +1 -1
- package/dist/src/stream-muxer/close-test.js.map +1 -1
- package/dist/src/stream-muxer/spawner.js +1 -1
- package/dist/src/stream-muxer/spawner.js.map +1 -1
- package/dist/src/topology/topology.js +1 -1
- package/dist/src/topology/topology.js.map +1 -1
- package/dist/src/transport/dial-test.js +1 -1
- package/dist/src/transport/dial-test.js.map +1 -1
- package/dist/src/transport/filter-test.js +1 -1
- package/dist/src/transport/filter-test.js.map +1 -1
- package/dist/src/transport/listen-test.js +1 -1
- package/dist/src/transport/listen-test.js.map +1 -1
- package/package.json +13 -12
- package/src/connection/connection.ts +1 -1
- package/src/connection-encrypter/index.ts +1 -1
- package/src/index.ts +49 -0
- package/src/mocks/upgrader.ts +1 -1
- package/src/peer-discovery/index.ts +15 -11
- package/src/pubsub/api.ts +1 -1
- package/src/pubsub/connection-handlers.ts +9 -15
- package/src/pubsub/emit-self.ts +6 -5
- package/src/pubsub/messages.ts +4 -3
- package/src/pubsub/multiple-nodes.ts +6 -13
- package/src/pubsub/two-nodes.ts +4 -5
- package/src/record/index.ts +1 -1
- package/src/stream-muxer/base-test.ts +1 -1
- package/src/stream-muxer/close-test.ts +1 -1
- package/src/stream-muxer/spawner.ts +1 -1
- package/src/topology/topology.ts +1 -1
- package/src/transport/dial-test.ts +1 -1
- package/src/transport/filter-test.ts +1 -1
- package/src/transport/listen-test.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expect } from 'aegir/
|
|
1
|
+
import { expect } from 'aegir/chai'
|
|
2
2
|
import sinon from 'sinon'
|
|
3
3
|
import pDefer from 'p-defer'
|
|
4
4
|
import pWaitFor from 'p-wait-for'
|
|
@@ -14,6 +14,7 @@ import type { PeerId } from '@libp2p/interfaces/peer-id'
|
|
|
14
14
|
import type { Registrar } from '@libp2p/interfaces/registrar'
|
|
15
15
|
import type { PubSubBaseProtocol } from '@libp2p/pubsub'
|
|
16
16
|
import { Components } from '@libp2p/interfaces/components'
|
|
17
|
+
import { start, stop } from '../index.js'
|
|
17
18
|
|
|
18
19
|
export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
19
20
|
describe('pubsub connection handlers', () => {
|
|
@@ -49,8 +50,7 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
49
50
|
})
|
|
50
51
|
|
|
51
52
|
// Start pubsub
|
|
52
|
-
await
|
|
53
|
-
await psB.start()
|
|
53
|
+
await start(psA, psB)
|
|
54
54
|
|
|
55
55
|
expect(psA.getPeers()).to.be.empty()
|
|
56
56
|
expect(psB.getPeers()).to.be.empty()
|
|
@@ -134,8 +134,7 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
134
134
|
init: {}
|
|
135
135
|
})
|
|
136
136
|
|
|
137
|
-
await
|
|
138
|
-
await psB.start()
|
|
137
|
+
await start(psA, psB)
|
|
139
138
|
})
|
|
140
139
|
|
|
141
140
|
afterEach(async () => {
|
|
@@ -231,15 +230,13 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
231
230
|
afterEach(async () => {
|
|
232
231
|
sinon.restore()
|
|
233
232
|
|
|
234
|
-
await
|
|
235
|
-
await psB.stop()
|
|
233
|
+
await stop(psA, psB)
|
|
236
234
|
|
|
237
235
|
await common.teardown()
|
|
238
236
|
})
|
|
239
237
|
|
|
240
238
|
it('should get notified of connected peers after starting', async () => {
|
|
241
|
-
await
|
|
242
|
-
await psB.start()
|
|
239
|
+
await start(psA, psB)
|
|
243
240
|
|
|
244
241
|
await connectPeers(psA.multicodecs[0], {
|
|
245
242
|
peerId: peerA,
|
|
@@ -260,8 +257,7 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
260
257
|
const topic = 'test-topic'
|
|
261
258
|
const data = uint8ArrayFromString('hey!')
|
|
262
259
|
|
|
263
|
-
await
|
|
264
|
-
await psB.start()
|
|
260
|
+
await start(psA, psB)
|
|
265
261
|
|
|
266
262
|
await connectPeers(psA.multicodecs[0], {
|
|
267
263
|
peerId: peerA,
|
|
@@ -331,15 +327,13 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
331
327
|
init: {}
|
|
332
328
|
})
|
|
333
329
|
|
|
334
|
-
await
|
|
335
|
-
await psB.start()
|
|
330
|
+
await start(psA, psB)
|
|
336
331
|
})
|
|
337
332
|
|
|
338
333
|
afterEach(async () => {
|
|
339
334
|
sinon.restore()
|
|
340
335
|
|
|
341
|
-
await
|
|
342
|
-
await psB.stop()
|
|
336
|
+
await stop(psA, psB)
|
|
343
337
|
|
|
344
338
|
await common.teardown()
|
|
345
339
|
})
|
package/src/pubsub/emit-self.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expect } from 'aegir/
|
|
1
|
+
import { expect } from 'aegir/chai'
|
|
2
2
|
import sinon from 'sinon'
|
|
3
3
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
4
4
|
import { createEd25519PeerId } from '@libp2p/peer-id-factory'
|
|
@@ -8,6 +8,7 @@ import type { TestSetup } from '../index.js'
|
|
|
8
8
|
import type { PubSubArgs } from './index.js'
|
|
9
9
|
import type { PubSubBaseProtocol } from '@libp2p/pubsub'
|
|
10
10
|
import { Components } from '@libp2p/interfaces/components'
|
|
11
|
+
import { start, stop } from '../index.js'
|
|
11
12
|
|
|
12
13
|
const topic = 'foo'
|
|
13
14
|
const data = uint8ArrayFromString('bar')
|
|
@@ -31,13 +32,13 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
31
32
|
})
|
|
32
33
|
|
|
33
34
|
before(async () => {
|
|
34
|
-
await
|
|
35
|
+
await start(pubsub)
|
|
35
36
|
pubsub.subscribe(topic)
|
|
36
37
|
})
|
|
37
38
|
|
|
38
39
|
after(async () => {
|
|
39
40
|
sinon.restore()
|
|
40
|
-
await
|
|
41
|
+
await stop(pubsub)
|
|
41
42
|
await common.teardown()
|
|
42
43
|
})
|
|
43
44
|
|
|
@@ -66,13 +67,13 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
66
67
|
})
|
|
67
68
|
|
|
68
69
|
before(async () => {
|
|
69
|
-
await
|
|
70
|
+
await start(pubsub)
|
|
70
71
|
pubsub.subscribe(topic)
|
|
71
72
|
})
|
|
72
73
|
|
|
73
74
|
after(async () => {
|
|
74
75
|
sinon.restore()
|
|
75
|
-
await
|
|
76
|
+
await stop(pubsub)
|
|
76
77
|
await common.teardown()
|
|
77
78
|
})
|
|
78
79
|
|
package/src/pubsub/messages.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expect } from 'aegir/
|
|
1
|
+
import { expect } from 'aegir/chai'
|
|
2
2
|
import sinon from 'sinon'
|
|
3
3
|
import { createEd25519PeerId } from '@libp2p/peer-id-factory'
|
|
4
4
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
@@ -15,6 +15,7 @@ import type { PubSubArgs } from './index.js'
|
|
|
15
15
|
import type { PubSubBaseProtocol } from '@libp2p/pubsub'
|
|
16
16
|
import { Components } from '@libp2p/interfaces/components'
|
|
17
17
|
import type { PeerId } from '@libp2p/interfaces/peer-id'
|
|
18
|
+
import { start, stop } from '../index.js'
|
|
18
19
|
|
|
19
20
|
const topic = 'foo'
|
|
20
21
|
const data = uint8ArrayFromString('bar')
|
|
@@ -37,12 +38,12 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
37
38
|
emitSelf: true
|
|
38
39
|
}
|
|
39
40
|
})
|
|
40
|
-
await
|
|
41
|
+
await start(pubsub)
|
|
41
42
|
})
|
|
42
43
|
|
|
43
44
|
afterEach(async () => {
|
|
44
45
|
sinon.restore()
|
|
45
|
-
await
|
|
46
|
+
await stop(pubsub)
|
|
46
47
|
await common.teardown()
|
|
47
48
|
})
|
|
48
49
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint max-nested-callbacks: ["error", 6] */
|
|
2
|
-
import { expect } from 'aegir/
|
|
2
|
+
import { expect } from 'aegir/chai'
|
|
3
3
|
import sinon from 'sinon'
|
|
4
4
|
import pDefer from 'p-defer'
|
|
5
5
|
import pWaitFor from 'p-wait-for'
|
|
@@ -16,6 +16,7 @@ import type { PeerId } from '@libp2p/interfaces/peer-id'
|
|
|
16
16
|
import type { Registrar } from '@libp2p/interfaces/registrar'
|
|
17
17
|
import type { PubSubBaseProtocol } from '@libp2p/pubsub'
|
|
18
18
|
import { Components } from '@libp2p/interfaces/components'
|
|
19
|
+
import { start, stop } from '../index.js'
|
|
19
20
|
|
|
20
21
|
export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
21
22
|
describe('pubsub with multiple nodes', function () {
|
|
@@ -73,9 +74,7 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
73
74
|
})
|
|
74
75
|
|
|
75
76
|
// Start pubsub modes
|
|
76
|
-
await
|
|
77
|
-
[psA, psB, psC].map(async (p) => await p.start())
|
|
78
|
-
)
|
|
77
|
+
await start(psA, psB, psC)
|
|
79
78
|
})
|
|
80
79
|
|
|
81
80
|
// Connect nodes
|
|
@@ -106,9 +105,7 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
106
105
|
afterEach(async () => {
|
|
107
106
|
sinon.restore()
|
|
108
107
|
|
|
109
|
-
await
|
|
110
|
-
[psA, psB, psC].map(async (p) => await p.stop())
|
|
111
|
-
)
|
|
108
|
+
await stop(psA, psB, psC)
|
|
112
109
|
|
|
113
110
|
await common.teardown()
|
|
114
111
|
})
|
|
@@ -353,9 +350,7 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
353
350
|
})
|
|
354
351
|
|
|
355
352
|
// Start pubsub nodes
|
|
356
|
-
await
|
|
357
|
-
[psA, psB, psC, psD, psE].map(async (p) => await p.start())
|
|
358
|
-
)
|
|
353
|
+
await start(psA, psB, psC, psD, psE)
|
|
359
354
|
})
|
|
360
355
|
|
|
361
356
|
// connect nodes
|
|
@@ -400,9 +395,7 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
400
395
|
})
|
|
401
396
|
|
|
402
397
|
afterEach(async () => {
|
|
403
|
-
await
|
|
404
|
-
[psA, psB, psC, psD, psE].map(async (p) => await p.stop())
|
|
405
|
-
)
|
|
398
|
+
await stop(psA, psB, psC, psD, psE)
|
|
406
399
|
await common.teardown()
|
|
407
400
|
})
|
|
408
401
|
|
package/src/pubsub/two-nodes.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint max-nested-callbacks: ["error", 6] */
|
|
2
|
-
import { expect } from 'aegir/
|
|
2
|
+
import { expect } from 'aegir/chai'
|
|
3
3
|
import sinon from 'sinon'
|
|
4
4
|
import pDefer from 'p-defer'
|
|
5
5
|
import pWaitFor from 'p-wait-for'
|
|
@@ -16,6 +16,7 @@ import type { PeerId } from '@libp2p/interfaces/peer-id'
|
|
|
16
16
|
import type { Registrar } from '@libp2p/interfaces/registrar'
|
|
17
17
|
import type { PubSubBaseProtocol } from '@libp2p/pubsub'
|
|
18
18
|
import { Components } from '@libp2p/interfaces/components'
|
|
19
|
+
import { start, stop } from '../index.js'
|
|
19
20
|
|
|
20
21
|
const topic = 'foo'
|
|
21
22
|
|
|
@@ -60,8 +61,7 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
60
61
|
})
|
|
61
62
|
|
|
62
63
|
// Start pubsub and connect nodes
|
|
63
|
-
await
|
|
64
|
-
await psB.start()
|
|
64
|
+
await start(psA, psB)
|
|
65
65
|
|
|
66
66
|
expect(psA.getPeers()).to.be.empty()
|
|
67
67
|
expect(psB.getPeers()).to.be.empty()
|
|
@@ -81,8 +81,7 @@ export default (common: TestSetup<PubSubBaseProtocol, PubSubArgs>) => {
|
|
|
81
81
|
afterEach(async () => {
|
|
82
82
|
sinon.restore()
|
|
83
83
|
|
|
84
|
-
await
|
|
85
|
-
await psB.stop()
|
|
84
|
+
await stop(psA, psB)
|
|
86
85
|
|
|
87
86
|
await common.teardown()
|
|
88
87
|
})
|
package/src/record/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { duplexPair } from 'it-pair/duplex'
|
|
|
4
4
|
import { abortableSource } from 'abortable-iterator'
|
|
5
5
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
6
6
|
import drain from 'it-drain'
|
|
7
|
-
import { expect } from 'aegir/
|
|
7
|
+
import { expect } from 'aegir/chai'
|
|
8
8
|
import delay from 'delay'
|
|
9
9
|
import type { TestSetup } from '../index.js'
|
|
10
10
|
import type { StreamMuxerFactory } from '@libp2p/interfaces/stream-muxer'
|
package/src/topology/topology.ts
CHANGED