mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-13 01:01:23 +00:00
fix: encode enums correctly (#1210)
Updates protons and regenerates protobuf code to encode enums correctly
This commit is contained in:
@ -20,6 +20,7 @@ import { DefaultConnectionManager } from '../../src/connection-manager/index.js'
|
||||
import { Plaintext } from '../../src/insecure/index.js'
|
||||
import { WebSockets } from '@libp2p/websockets'
|
||||
import { Mplex } from '@libp2p/mplex'
|
||||
import type { PeerProtocolsChangeData } from '@libp2p/interfaces/peer-store'
|
||||
|
||||
const protocol = '/test/1.0.0'
|
||||
|
||||
@ -145,6 +146,15 @@ describe('registrar', () => {
|
||||
detail: conn
|
||||
}))
|
||||
|
||||
// identify completes
|
||||
await libp2p.components.getPeerStore().dispatchEvent(new CustomEvent<PeerProtocolsChangeData>('change:protocols', {
|
||||
detail: {
|
||||
peerId: conn.remotePeer,
|
||||
protocols: [protocol],
|
||||
oldProtocols: []
|
||||
}
|
||||
}))
|
||||
|
||||
// remote peer disconnects
|
||||
await conn.close()
|
||||
await libp2p.components.getUpgrader().dispatchEvent(new CustomEvent<Connection>('connectionEnd', {
|
||||
@ -186,10 +196,20 @@ describe('registrar', () => {
|
||||
// Add protocol to peer and update it
|
||||
await libp2p.peerStore.protoBook.add(remotePeerId, [protocol])
|
||||
|
||||
// remote peer connects
|
||||
await libp2p.components.getUpgrader().dispatchEvent(new CustomEvent<Connection>('connection', {
|
||||
detail: conn
|
||||
}))
|
||||
|
||||
// identify completes
|
||||
await libp2p.components.getPeerStore().dispatchEvent(new CustomEvent<PeerProtocolsChangeData>('change:protocols', {
|
||||
detail: {
|
||||
peerId: conn.remotePeer,
|
||||
protocols: [protocol],
|
||||
oldProtocols: []
|
||||
}
|
||||
}))
|
||||
|
||||
await onConnectDefer.promise
|
||||
|
||||
// Peer no longer supports the protocol our topology is registered for
|
||||
|
@ -47,7 +47,7 @@ describe('Transport Manager (WebSockets)', () => {
|
||||
tm.add(transport)
|
||||
|
||||
expect(tm.getTransports()).to.have.lengthOf(1)
|
||||
await tm.remove(transport.constructor.name)
|
||||
await tm.remove(transport[Symbol.toStringTag])
|
||||
expect(tm.getTransports()).to.have.lengthOf(0)
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user