File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -270,6 +270,30 @@ impl StatsRepository {
270270#[ cfg( test) ]  
271271mod  tests { 
272272
273+     mod  stats_tracker { 
274+         use  crate :: statistics:: { StatsTracker ,  TrackerStatistics ,  TrackerStatisticsEvent } ; 
275+ 
276+         #[ tokio:: test]  
277+         async  fn  should_contain_the_tracker_statistics ( )  { 
278+             let  stats_tracker = StatsTracker :: new ( ) ; 
279+ 
280+             let  stats = stats_tracker. stats_repository . get_stats ( ) . await ; 
281+ 
282+             assert_eq ! ( stats. tcp4_announces_handled,  TrackerStatistics :: new( ) . tcp4_announces_handled) ; 
283+         } 
284+ 
285+         #[ tokio:: test]  
286+         async  fn  should_create_an_event_sender_to_send_statistical_events ( )  { 
287+             let  mut  stats_tracker = StatsTracker :: new ( ) ; 
288+ 
289+             let  event_sender = stats_tracker. run_event_listener ( ) ; 
290+ 
291+             let  result = event_sender. send_event ( TrackerStatisticsEvent :: Udp4Connect ) . await ; 
292+ 
293+             assert ! ( result. is_some( ) ) ; 
294+         } 
295+     } 
296+ 
273297    mod  event_handler { 
274298        use  crate :: statistics:: { event_handler,  StatsRepository ,  TrackerStatisticsEvent } ; 
275299
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments