@@ -22,6 +22,16 @@ void main() {
2222 late File logFile;
2323
2424 final testEvent = Event .hotReloadTime (timeMs: 10 );
25+ final propertyEditorEvent = Event .devtoolsEvent (
26+ label: devtoolsEventLabel,
27+ screen: propertyEditorId,
28+ eventCategory: 'test' ,
29+ value: 1 );
30+ final devToolsEvent = Event .devtoolsEvent (
31+ label: devtoolsEventLabel,
32+ screen: 'inspector' ,
33+ eventCategory: 'test' ,
34+ value: 1 );
2535
2636 setUp (() {
2737 fs = MemoryFileSystem .test (style: FileSystemStyle .posix);
@@ -71,6 +81,26 @@ void main() {
7181 expect (analytics.logFileStats ()! .recordCount, countOfEventsToSend);
7282 });
7383
84+ test ('LogFileStats handles granular events' , () async {
85+ final countOfPropertyEditorEventsToSend = 5 ;
86+ final countOfDevToolsEventsToSend = 10 ;
87+
88+ for (var i = 0 ; i < countOfPropertyEditorEventsToSend; i++ ) {
89+ analytics.send (propertyEditorEvent);
90+ }
91+ for (var i = 0 ; i < countOfDevToolsEventsToSend; i++ ) {
92+ analytics.send (devToolsEvent);
93+ }
94+
95+ expect (analytics.logFileStats (), isNotNull);
96+ expect (logFile.readAsLinesSync ().length,
97+ countOfPropertyEditorEventsToSend + countOfDevToolsEventsToSend);
98+ expect (analytics.logFileStats ()! .eventCount['property_editor' ],
99+ countOfPropertyEditorEventsToSend);
100+ expect (analytics.logFileStats ()! .eventCount['devtools_event' ],
101+ countOfDevToolsEventsToSend);
102+ });
103+
74104 test ('The only record in the log file is malformed' , () async {
75105 // Write invalid json for the only log record
76106 logFile.writeAsStringSync ('{{\n ' );
0 commit comments