@@ -92,6 +92,19 @@ describe('wid/lib/PeriodicWebRTCStatsReporter', () => {
9292 expect ( parseMethodDouble . getCalls ( ) ) . to . have . length ( numberOfIntervals ) ;
9393 } ) ;
9494
95+ it ( 'should emit stats parsed event' , async ( ) => {
96+ const getStatsInterval = faker . datatype . number ( { min : 1 , max : 9999 } ) ;
97+ const compositeStatsParser = createCompositeStatsParserFake ( ) ;
98+ const reporter = createPeriodicStatsReporter ( { compositeStatsParser, getStatsInterval } ) ;
99+ sandbox . stub ( compositeStatsParser , 'parse' ) ;
100+ const emitSpy = sandbox . spy ( reporter , 'emit' ) ;
101+
102+ reporter . startReporting ( ) ;
103+ await clock . tickAsync ( getStatsInterval ) ;
104+
105+ expect ( emitSpy ) . to . be . calledWith ( PeriodicWebRTCStatsReporter . STATS_REPORTS_PARSED , { timeTaken : 0 } ) ;
106+ } ) ;
107+
95108 it ( 'should emit stats report ready event for each stats report item' , async ( ) => {
96109 const getStatsInterval = faker . datatype . number ( { min : 1 , max : 9999 } ) ;
97110 const compositeStatsParser = createCompositeStatsParserFake ( ) ;
@@ -105,9 +118,8 @@ describe('wid/lib/PeriodicWebRTCStatsReporter', () => {
105118 reporter . startReporting ( ) ;
106119 await clock . tickAsync ( getStatsInterval ) ;
107120
108- expect ( emitSpy ) . to . be . calledTwice ;
109- expect ( emitSpy . getCall ( 0 ) ) . to . be . calledWithExactly ( PeriodicWebRTCStatsReporter . STATS_REPORT_READY_EVENT , firstReportItem ) ;
110- expect ( emitSpy . getCall ( 1 ) ) . to . be . calledWithExactly ( PeriodicWebRTCStatsReporter . STATS_REPORT_READY_EVENT , secondReportItem ) ;
121+ expect ( emitSpy ) . to . be . calledWith ( PeriodicWebRTCStatsReporter . STATS_REPORT_READY_EVENT , firstReportItem ) ;
122+ expect ( emitSpy ) . to . be . calledWith ( PeriodicWebRTCStatsReporter . STATS_REPORT_READY_EVENT , secondReportItem ) ;
111123 } ) ;
112124
113125 it ( 'should be be in stopped state' , async ( ) => {
0 commit comments