@@ -105,8 +105,8 @@ describe('identify', () => {
105105 } )
106106
107107 it ( 'should be able to identify another peer' , async ( ) => {
108- const localIdentify = new DefaultIdentifyService ( localComponents , defaultInit )
109- const remoteIdentify = new DefaultIdentifyService ( remoteComponents , defaultInit )
108+ const localIdentify = identifyService ( defaultInit ) ( localComponents )
109+ const remoteIdentify = identifyService ( defaultInit ) ( remoteComponents )
110110
111111 await start ( localIdentify )
112112 await start ( remoteIdentify )
@@ -128,8 +128,8 @@ describe('identify', () => {
128128 } )
129129
130130 it ( 'should throw if identified peer is the wrong peer' , async ( ) => {
131- const localIdentify = new DefaultIdentifyService ( localComponents , defaultInit )
132- const remoteIdentify = new DefaultIdentifyService ( remoteComponents , defaultInit )
131+ const localIdentify = identifyService ( defaultInit ) ( localComponents )
132+ const remoteIdentify = identifyService ( defaultInit ) ( remoteComponents )
133133
134134 await start ( localIdentify )
135135 await start ( remoteIdentify )
@@ -191,8 +191,8 @@ describe('identify', () => {
191191 } )
192192
193193 it ( 'should time out during identify' , async ( ) => {
194- const localIdentify = new DefaultIdentifyService ( localComponents , defaultInit )
195- const remoteIdentify = new DefaultIdentifyService ( remoteComponents , defaultInit )
194+ const localIdentify = identifyService ( defaultInit ) ( localComponents )
195+ const remoteIdentify = identifyService ( defaultInit ) ( remoteComponents )
196196
197197 await start ( localIdentify )
198198 await start ( remoteIdentify )
@@ -237,10 +237,10 @@ describe('identify', () => {
237237 it ( 'should limit incoming identify message sizes' , async ( ) => {
238238 const deferred = pDefer ( )
239239
240- const remoteIdentify = new DefaultIdentifyService ( remoteComponents , {
240+ const remoteIdentify = identifyService ( {
241241 ...defaultInit ,
242242 maxIdentifyMessageSize : 100
243- } )
243+ } ) ( remoteComponents )
244244 await start ( remoteIdentify )
245245
246246 const identifySpy = sinon . spy ( remoteIdentify , 'identify' )
@@ -283,10 +283,10 @@ describe('identify', () => {
283283 it ( 'should time out incoming identify messages' , async ( ) => {
284284 const deferred = pDefer ( )
285285
286- const remoteIdentify = new DefaultIdentifyService ( remoteComponents , {
286+ const remoteIdentify = identifyService ( {
287287 ...defaultInit ,
288288 timeout : 100
289- } )
289+ } ) ( remoteComponents )
290290 await start ( remoteIdentify )
291291
292292 const identifySpy = sinon . spy ( remoteIdentify , 'identify' )
@@ -336,8 +336,8 @@ describe('identify', () => {
336336 } )
337337
338338 it ( 'should retain existing peer metadata' , async ( ) => {
339- const localIdentify = new DefaultIdentifyService ( localComponents , defaultInit )
340- const remoteIdentify = new DefaultIdentifyService ( remoteComponents , defaultInit )
339+ const localIdentify = identifyService ( defaultInit ) ( localComponents )
340+ const remoteIdentify = identifyService ( defaultInit ) ( remoteComponents )
341341
342342 await start ( localIdentify )
343343 await start ( remoteIdentify )
@@ -363,8 +363,8 @@ describe('identify', () => {
363363 } )
364364
365365 it ( 'should ignore older signed peer record' , async ( ) => {
366- const localIdentify = new DefaultIdentifyService ( localComponents , defaultInit )
367- const remoteIdentify = new DefaultIdentifyService ( remoteComponents , defaultInit )
366+ const localIdentify = identifyService ( defaultInit ) ( localComponents )
367+ const remoteIdentify = identifyService ( defaultInit ) ( remoteComponents )
368368
369369 await start ( localIdentify )
370370 await start ( remoteIdentify )
0 commit comments