@@ -22,7 +22,7 @@ import { pipe } from 'it-pipe'
2222import { pushable } from 'it-pushable'
2323import pDefer from 'p-defer'
2424import pWaitFor from 'p-wait-for'
25- import sinon from 'sinon'
25+ import Sinon from 'sinon'
2626import { stubInterface } from 'sinon-ts'
2727import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
2828import { DefaultAddressManager } from '../../src/address-manager/index.js'
@@ -49,10 +49,10 @@ describe('dialing (direct, TCP)', () => {
4949 let remoteAddr : Multiaddr
5050 let remoteComponents : Components
5151 let localComponents : Components
52- let resolver : sinon . SinonStub < [ Multiaddr ] , Promise < string [ ] > >
52+ let resolver : Sinon . SinonStub < [ Multiaddr ] , Promise < string [ ] > >
5353
5454 beforeEach ( async ( ) => {
55- resolver = sinon . stub < [ Multiaddr ] , Promise < string [ ] > > ( )
55+ resolver = Sinon . stub < [ Multiaddr ] , Promise < string [ ] > > ( )
5656 const [ localPeerId , remotePeerId ] = await Promise . all ( [
5757 createEd25519PeerId ( ) ,
5858 createEd25519PeerId ( )
@@ -66,7 +66,7 @@ describe('dialing (direct, TCP)', () => {
6666 upgrader : mockUpgrader ( { events : remoteEvents } ) ,
6767 connectionGater : mockConnectionGater ( ) ,
6868 transportManager : stubInterface < TransportManager > ( {
69- getAddrs : [ ]
69+ getAddrs : Sinon . stub ( ) . returns ( [ ] )
7070 } )
7171 } )
7272 remoteComponents . peerStore = new PersistentPeerStore ( remoteComponents )
@@ -109,7 +109,7 @@ describe('dialing (direct, TCP)', () => {
109109 } )
110110
111111 afterEach ( ( ) => {
112- sinon . restore ( )
112+ Sinon . restore ( )
113113 } )
114114
115115 it ( 'should be able to connect to a remote node via its multiaddr' , async ( ) => {
@@ -194,7 +194,7 @@ describe('dialing (direct, TCP)', () => {
194194
195195 const dialer = new DialQueue ( localComponents )
196196
197- sinon . spy ( localTM , 'dial' )
197+ Sinon . spy ( localTM , 'dial' )
198198 const connection = await dialer . dial ( peerId )
199199 expect ( localTM . dial ) . to . have . property ( 'callCount' , remoteAddrs . length )
200200 expect ( connection ) . to . exist ( )
@@ -207,7 +207,7 @@ describe('dialing (direct, TCP)', () => {
207207 dialTimeout : 50
208208 } )
209209
210- sinon . stub ( localTM , 'dial' ) . callsFake ( async ( addr , options = { } ) => {
210+ Sinon . stub ( localTM , 'dial' ) . callsFake ( async ( addr , options = { } ) => {
211211 expect ( options . signal ) . to . exist ( )
212212 expect ( options . signal ?. aborted ) . to . equal ( false )
213213 expect ( addr . toString ( ) ) . to . eql ( remoteAddr . toString ( ) )
@@ -235,7 +235,7 @@ describe('dialing (direct, TCP)', () => {
235235 } )
236236
237237 const deferredDial = pDefer < Connection > ( )
238- const transportManagerDialStub = sinon . stub ( localTM , 'dial' )
238+ const transportManagerDialStub = Sinon . stub ( localTM , 'dial' )
239239 transportManagerDialStub . callsFake ( async ( ) => deferredDial . promise )
240240
241241 // Perform 3 multiaddr dials
@@ -273,7 +273,7 @@ describe('dialing (direct, TCP)', () => {
273273 maxParallelDialsPerPeer : 10
274274 } )
275275
276- const transportManagerDialStub = sinon . stub ( localTM , 'dial' )
276+ const transportManagerDialStub = Sinon . stub ( localTM , 'dial' )
277277 transportManagerDialStub . callsFake ( async ( ma ) => {
278278 await delay ( 10 )
279279 return mockConnection ( mockMultiaddrConnection ( mockDuplex ( ) , remoteComponents . peerId ) )
@@ -340,7 +340,7 @@ describe('libp2p.dialer (direct, TCP)', () => {
340340 } )
341341
342342 afterEach ( async ( ) => {
343- sinon . restore ( )
343+ Sinon . restore ( )
344344
345345 if ( libp2p != null ) {
346346 await libp2p . stop ( )
@@ -515,7 +515,7 @@ describe('libp2p.dialer (direct, TCP)', () => {
515515 connectionProtector : ( ) => protector
516516 } )
517517
518- const protectorProtectSpy = sinon . spy ( protector , 'protect' )
518+ const protectorProtectSpy = Sinon . spy ( protector , 'protect' )
519519
520520 remoteLibp2p . components . connectionProtector = preSharedKey ( { psk : swarmKeyBuffer } ) ( )
521521
@@ -589,7 +589,7 @@ describe('libp2p.dialer (direct, TCP)', () => {
589589
590590 const dials = 10
591591 const error = new Error ( 'Boom' )
592- sinon . stub ( libp2p . components . transportManager , 'dial' ) . callsFake ( async ( ) => Promise . reject ( error ) )
592+ Sinon . stub ( libp2p . components . transportManager , 'dial' ) . callsFake ( async ( ) => Promise . reject ( error ) )
593593
594594 await libp2p . peerStore . patch ( remotePeerId , {
595595 multiaddrs : remoteLibp2p . getMultiaddrs ( )
0 commit comments