@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.
Files changed (66) hide show
  1. package/dist/src/connection/connection.js +1 -1
  2. package/dist/src/connection/connection.js.map +1 -1
  3. package/dist/src/connection-encrypter/index.js +1 -1
  4. package/dist/src/connection-encrypter/index.js.map +1 -1
  5. package/dist/src/index.d.ts +3 -0
  6. package/dist/src/index.d.ts.map +1 -1
  7. package/dist/src/index.js +30 -1
  8. package/dist/src/index.js.map +1 -1
  9. package/dist/src/mocks/upgrader.js +1 -1
  10. package/dist/src/mocks/upgrader.js.map +1 -1
  11. package/dist/src/peer-discovery/index.d.ts.map +1 -1
  12. package/dist/src/peer-discovery/index.js +12 -11
  13. package/dist/src/peer-discovery/index.js.map +1 -1
  14. package/dist/src/pubsub/api.js +1 -1
  15. package/dist/src/pubsub/api.js.map +1 -1
  16. package/dist/src/pubsub/connection-handlers.d.ts.map +1 -1
  17. package/dist/src/pubsub/connection-handlers.js +9 -15
  18. package/dist/src/pubsub/connection-handlers.js.map +1 -1
  19. package/dist/src/pubsub/emit-self.d.ts.map +1 -1
  20. package/dist/src/pubsub/emit-self.js +6 -5
  21. package/dist/src/pubsub/emit-self.js.map +1 -1
  22. package/dist/src/pubsub/messages.d.ts.map +1 -1
  23. package/dist/src/pubsub/messages.js +4 -3
  24. package/dist/src/pubsub/messages.js.map +1 -1
  25. package/dist/src/pubsub/multiple-nodes.d.ts.map +1 -1
  26. package/dist/src/pubsub/multiple-nodes.js +6 -5
  27. package/dist/src/pubsub/multiple-nodes.js.map +1 -1
  28. package/dist/src/pubsub/two-nodes.d.ts.map +1 -1
  29. package/dist/src/pubsub/two-nodes.js +4 -5
  30. package/dist/src/pubsub/two-nodes.js.map +1 -1
  31. package/dist/src/record/index.js +1 -1
  32. package/dist/src/record/index.js.map +1 -1
  33. package/dist/src/stream-muxer/base-test.js +1 -1
  34. package/dist/src/stream-muxer/base-test.js.map +1 -1
  35. package/dist/src/stream-muxer/close-test.js +1 -1
  36. package/dist/src/stream-muxer/close-test.js.map +1 -1
  37. package/dist/src/stream-muxer/spawner.js +1 -1
  38. package/dist/src/stream-muxer/spawner.js.map +1 -1
  39. package/dist/src/topology/topology.js +1 -1
  40. package/dist/src/topology/topology.js.map +1 -1
  41. package/dist/src/transport/dial-test.js +1 -1
  42. package/dist/src/transport/dial-test.js.map +1 -1
  43. package/dist/src/transport/filter-test.js +1 -1
  44. package/dist/src/transport/filter-test.js.map +1 -1
  45. package/dist/src/transport/listen-test.js +1 -1
  46. package/dist/src/transport/listen-test.js.map +1 -1
  47. package/package.json +13 -12
  48. package/src/connection/connection.ts +1 -1
  49. package/src/connection-encrypter/index.ts +1 -1
  50. package/src/index.ts +49 -0
  51. package/src/mocks/upgrader.ts +1 -1
  52. package/src/peer-discovery/index.ts +15 -11
  53. package/src/pubsub/api.ts +1 -1
  54. package/src/pubsub/connection-handlers.ts +9 -15
  55. package/src/pubsub/emit-self.ts +6 -5
  56. package/src/pubsub/messages.ts +4 -3
  57. package/src/pubsub/multiple-nodes.ts +6 -13
  58. package/src/pubsub/two-nodes.ts +4 -5
  59. package/src/record/index.ts +1 -1
  60. package/src/stream-muxer/base-test.ts +1 -1
  61. package/src/stream-muxer/close-test.ts +1 -1
  62. package/src/stream-muxer/spawner.ts +1 -1
  63. package/src/topology/topology.ts +1 -1
  64. package/src/transport/dial-test.ts +1 -1
  65. package/src/transport/filter-test.ts +1 -1
  66. package/src/transport/listen-test.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { expect } from 'aegir/utils/chai.js'
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 psA.start()
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 psA.start()
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 psA.stop()
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 psA.start()
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 psA.start()
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 psA.start()
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 psA.stop()
342
- await psB.stop()
336
+ await stop(psA, psB)
343
337
 
344
338
  await common.teardown()
345
339
  })
@@ -1,4 +1,4 @@
1
- import { expect } from 'aegir/utils/chai.js'
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 pubsub.start()
35
+ await start(pubsub)
35
36
  pubsub.subscribe(topic)
36
37
  })
37
38
 
38
39
  after(async () => {
39
40
  sinon.restore()
40
- await pubsub.stop()
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 pubsub.start()
70
+ await start(pubsub)
70
71
  pubsub.subscribe(topic)
71
72
  })
72
73
 
73
74
  after(async () => {
74
75
  sinon.restore()
75
- await pubsub.stop()
76
+ await stop(pubsub)
76
77
  await common.teardown()
77
78
  })
78
79
 
@@ -1,4 +1,4 @@
1
- import { expect } from 'aegir/utils/chai.js'
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 pubsub.start()
41
+ await start(pubsub)
41
42
  })
42
43
 
43
44
  afterEach(async () => {
44
45
  sinon.restore()
45
- await pubsub.stop()
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/utils/chai.js'
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 Promise.all(
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 Promise.all(
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 Promise.all(
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 Promise.all(
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
 
@@ -1,5 +1,5 @@
1
1
  /* eslint max-nested-callbacks: ["error", 6] */
2
- import { expect } from 'aegir/utils/chai.js'
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 psA.start()
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 psA.stop()
85
- await psB.stop()
84
+ await stop(psA, psB)
86
85
 
87
86
  await common.teardown()
88
87
  })
@@ -1,4 +1,4 @@
1
- import { expect } from 'aegir/utils/chai.js'
1
+ import { expect } from 'aegir/chai'
2
2
  import type { TestSetup } from '../index.js'
3
3
  import type { Record } from '@libp2p/interfaces/record'
4
4
 
@@ -1,4 +1,4 @@
1
- import { expect } from 'aegir/utils/chai.js'
1
+ import { expect } from 'aegir/chai'
2
2
  import { duplexPair } from 'it-pair/duplex'
3
3
  import { pipe } from 'it-pipe'
4
4
  import drain from 'it-drain'
@@ -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/utils/chai.js'
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'
@@ -1,4 +1,4 @@
1
- import { expect } from 'aegir/utils/chai.js'
1
+ import { expect } from 'aegir/chai'
2
2
  import { duplexPair } from 'it-pair/duplex'
3
3
  import { pipe } from 'it-pipe'
4
4
  import pLimit from 'p-limit'
@@ -1,4 +1,4 @@
1
- import { expect } from 'aegir/utils/chai.js'
1
+ import { expect } from 'aegir/chai'
2
2
  import sinon from 'sinon'
3
3
  import type { TestSetup } from '../index.js'
4
4
  import type { Topology } from '@libp2p/interfaces/topology'
@@ -1,4 +1,4 @@
1
- import { expect } from 'aegir/utils/chai.js'
1
+ import { expect } from 'aegir/chai'
2
2
  import { isValidTick } from '../utils/is-valid-tick.js'
3
3
  import { mockUpgrader } from '../mocks/upgrader.js'
4
4
  import { mockRegistrar } from '../mocks/registrar.js'
@@ -1,4 +1,4 @@
1
- import { expect } from 'aegir/utils/chai.js'
1
+ import { expect } from 'aegir/chai'
2
2
  import type { TestSetup } from '../index.js'
3
3
  import type { Transport } from '@libp2p/interfaces/transport'
4
4
  import type { TransportTestFixtures } from './index.js'
@@ -1,5 +1,5 @@
1
1
  /* eslint max-nested-callbacks: ["error", 8] */
2
- import { expect } from 'aegir/utils/chai.js'
2
+ import { expect } from 'aegir/chai'
3
3
  import sinon from 'sinon'
4
4
  import pWaitFor from 'p-wait-for'
5
5
  import { pipe } from 'it-pipe'