Fix tracing path and display issues

This commit is contained in:
Janez T
2026-03-12 14:08:00 +01:00
parent b38a8c55d6
commit 2d1e6c0ca4
11 changed files with 1021 additions and 89 deletions

View File

@@ -161,15 +161,23 @@ void main() {
expect(selection.mode, PathSelectionMode.flood);
});
test('received public byte path is added to history', () async {
final service = PathHistoryService();
await service.initialize();
await service.recordReceivedBytePath('abc123', [0x01, 0x02, 0x03], 3);
test(
'received public byte path is reversed before adding to history',
() async {
final service = PathHistoryService();
await service.initialize();
await service.recordReceivedBytePath('abc123', [
0x01,
0x02,
0x03,
0x04,
], 2);
final history = service.historyFor('abc123');
expect(history.directPaths, hasLength(1));
expect(history.directPaths.single.pathBytes, [0x01, 0x02, 0x03]);
expect(history.directPaths.single.hashSize, 3);
expect(history.directPaths.single.hopCount, 1);
});
final history = service.historyFor('abc123');
expect(history.directPaths, hasLength(1));
expect(history.directPaths.single.pathBytes, [0x03, 0x04, 0x01, 0x02]);
expect(history.directPaths.single.hashSize, 2);
expect(history.directPaths.single.hopCount, 2);
},
);
}