@@ -59,9 +59,9 @@ tape('[Libp2pPeer]', async (t) => {
59
59
60
60
t . test ( 'should connect to peer' , async ( t ) => {
61
61
const config = new Config ( { loglevel : 'error' } )
62
- const peer = new Libp2pPeer ( { config } )
62
+ const peer : any = new Libp2pPeer ( { config } )
63
63
peer . bindProtocols = td . func < typeof peer [ 'bindProtocol' ] > ( )
64
- td . when ( peer . bindProtocols ( td . matchers . anything ( ) , peerInfo ) ) . thenResolve ( )
64
+ td . when ( peer . bindProtocols ( td . matchers . anything ( ) , peerInfo ) ) . thenResolve ( null )
65
65
peer . on ( 'connected' , ( ) => {
66
66
t . pass ( 'connected' )
67
67
t . end ( )
@@ -71,9 +71,9 @@ tape('[Libp2pPeer]', async (t) => {
71
71
72
72
t . test ( 'should accept peer connection' , async ( t ) => {
73
73
const config = new Config ( { loglevel : 'error' } )
74
- const peer = new Libp2pPeer ( { config } )
74
+ const peer : any = new Libp2pPeer ( { config } )
75
75
peer . bindProtocol = td . func < typeof peer [ 'bindProtocol' ] > ( )
76
- td . when ( peer . bindProtocol ( 'proto' as any , 'conn' as any ) ) . thenResolve ( )
76
+ td . when ( peer . bindProtocol ( 'proto' as any , 'conn' as any ) ) . thenResolve ( null )
77
77
await peer . accept ( 'proto' , 'conn' , 'server' )
78
78
t . equals ( peer . server , 'server' , 'server set' )
79
79
t . ok ( peer . inbound , 'inbound set to true' )
@@ -84,12 +84,12 @@ tape('[Libp2pPeer]', async (t) => {
84
84
const config = new Config ( { loglevel : 'error' } )
85
85
const protocol = { name : 'proto' , versions : [ 1 ] , open : ( ) => { } } as Protocol
86
86
const badProto = { name : 'bad' , versions : [ 1 ] , open : ( ) => { } } as Protocol
87
- const peer = new Libp2pPeer ( { config, protocols : [ protocol , badProto ] } )
87
+ const peer : any = new Libp2pPeer ( { config, protocols : [ protocol , badProto ] } )
88
88
const node = new Libp2pNode ( ) as any
89
89
peer . bindProtocol = td . func < typeof peer [ 'bindProtocol' ] > ( )
90
90
protocol . open = td . func < Protocol [ 'open' ] > ( )
91
91
badProto . open = td . func < Protocol [ 'open' ] > ( )
92
- td . when ( peer . bindProtocol ( protocol , td . matchers . isA ( Libp2pSender ) ) ) . thenResolve ( )
92
+ td . when ( peer . bindProtocol ( protocol , td . matchers . isA ( Libp2pSender ) ) ) . thenResolve ( null )
93
93
td . when ( protocol . open ( ) ) . thenResolve ( )
94
94
td . when ( node . asyncDialProtocol ( peerInfo , '/proto/1' ) ) . thenResolve ( null )
95
95
td . when ( node . asyncDialProtocol ( peerInfo , '/bad/1' ) ) . thenReject ( new Error ( 'bad' ) )
0 commit comments