mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 08:20:36 +00:00
Allow overriding contact name
This commit is contained in:
@@ -122,6 +122,27 @@ void main() {
|
||||
expect(snapshot.busyness, LiveTrafficBusyness.quiet);
|
||||
});
|
||||
|
||||
test('normalizes packet rate for windows longer than one minute', () {
|
||||
final now = DateTime(2026, 3, 12, 12, 0, 0);
|
||||
final snapshot = LiveTrafficSummary.fromLogs(
|
||||
List.generate(
|
||||
24,
|
||||
(index) => _log(
|
||||
timestamp: now.subtract(Duration(seconds: index * 10)),
|
||||
direction: PacketDirection.rx,
|
||||
rawData: [0x88, 0x00, 0x00],
|
||||
responseCode: 0x88,
|
||||
),
|
||||
),
|
||||
now: now,
|
||||
window: const Duration(minutes: 5),
|
||||
);
|
||||
|
||||
expect(snapshot.totalCount, 24);
|
||||
expect(snapshot.windowDuration, const Duration(minutes: 5));
|
||||
expect(snapshot.packetsPerMinute, 5);
|
||||
});
|
||||
|
||||
test('supports clearing the live view without mutating source logs', () {
|
||||
final now = DateTime(2026, 3, 12, 12, 0, 0);
|
||||
final clearAt = now.subtract(const Duration(seconds: 8));
|
||||
|
||||
@@ -98,4 +98,14 @@ void main() {
|
||||
DateTime.fromMillisecondsSinceEpoch(1700000100400),
|
||||
);
|
||||
});
|
||||
|
||||
test('persists removed SAR marker IDs', () async {
|
||||
final storage = MessageStorageService();
|
||||
|
||||
await storage.saveRemovedSarMarkerIds({'sar-2', 'sar-1'});
|
||||
|
||||
final restored = await storage.loadRemovedSarMarkerIds();
|
||||
|
||||
expect(restored, equals({'sar-1', 'sar-2'}));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user