@@ -59,8 +59,8 @@ describe('peer discovery', () => {
5959 } )
6060 }
6161
62- describe ( 'module registration' , ( ) => {
63- it ( 'should enable module by default' , ( done ) => {
62+ describe . only ( 'module registration' , ( ) => {
63+ it ( 'should enable by default a module passed as an object ' , ( done ) => {
6464 const mockDiscovery = {
6565 on : sinon . stub ( ) ,
6666 start : sinon . stub ( ) . callsArg ( 0 ) ,
@@ -80,6 +80,28 @@ describe('peer discovery', () => {
8080 } )
8181 } )
8282
83+ it ( 'should enable by default a module passed as a function' , ( done ) => {
84+ const mockDiscovery = {
85+ on : sinon . stub ( ) ,
86+ start : sinon . stub ( ) . callsArg ( 0 ) ,
87+ stop : sinon . stub ( ) . callsArg ( 0 )
88+ }
89+
90+ const MockDiscovery = sinon . stub ( ) . returns ( mockDiscovery )
91+
92+ const options = { modules : { peerDiscovery : [ MockDiscovery ] } }
93+
94+ createNode ( [ '/ip4/0.0.0.0/tcp/0' ] , options , ( err , node ) => {
95+ expect ( err ) . to . not . exist ( )
96+
97+ node . start ( ( err ) => {
98+ expect ( err ) . to . not . exist ( )
99+ expect ( mockDiscovery . start . called ) . to . be . true ( )
100+ node . stop ( done )
101+ } )
102+ } )
103+ } )
104+
83105 it ( 'should enable module by configutation' , ( done ) => {
84106 const mockDiscovery = {
85107 on : sinon . stub ( ) ,
0 commit comments