File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
v-next/hardhat/test/internal/builtin-plugins/network-manager Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -470,6 +470,17 @@ describe("edr-provider", () => {
470470 { } ,
471471 ) ;
472472 } ) ;
473+
474+ it ( "should remove all listeners after closing" , async ( ) => {
475+ const connection = await hre . network . connect ( ) ;
476+
477+ connection . provider . on ( "notification" , ( ) => { } ) ;
478+ assert . equal ( connection . provider . listenerCount ( "notification" ) , 1 ) ;
479+
480+ await connection . provider . close ( ) ;
481+
482+ assert . equal ( connection . provider . listenerCount ( "notification" ) , 0 ) ;
483+ } ) ;
473484 } ) ;
474485
475486 describe ( "isDefaultEdrNetworkHDAccountsConfig" , ( ) => {
Original file line number Diff line number Diff line change @@ -579,5 +579,20 @@ describe("http-provider", () => {
579579 { } ,
580580 ) ;
581581 } ) ;
582+
583+ it ( "should remove all listeners after closing" , async ( ) => {
584+ const provider = await HttpProvider . create ( {
585+ url : "http://localhost" ,
586+ networkName : "exampleNetwork" ,
587+ timeout : 20_000 ,
588+ } ) ;
589+
590+ provider . on ( "notification" , ( ) => { } ) ;
591+ assert . equal ( provider . listenerCount ( "notification" ) , 1 ) ;
592+
593+ await provider . close ( ) ;
594+
595+ assert . equal ( provider . listenerCount ( "notification" ) , 0 ) ;
596+ } ) ;
582597 } ) ;
583598} ) ;
You can’t perform that action at this time.
0 commit comments