Refactor LoRa airtime tests and add new functionality

- Updated LoRa airtime calculations in `lora_airtime_test.dart` to reflect new reference values.
- Introduced new tests for LDRO behavior and preamble symbol calculations.
- Added `contact_path_width_test.dart` to validate path hash width handling in contacts.
- Enhanced `model_changes_test.dart` to ensure legacy data migration works correctly.
- Created `remote_node_stats_test.dart` to decode and validate remote node statistics.
- Implemented `map_marker_parse_test.dart` for parsing marker text with coordinate validation.
- Developed `map_tile_cache_key_test.dart` to ensure API keys are excluded from cache keys.
- Added `message_retry_failure_test.dart` to test message retry service behavior on failures.
- Extended `path_history_service_test.dart` to preserve learned state across path attempts.
- Enhanced `received_image_store_test.dart` to handle concurrent writes and review fixes.
- Implemented `repeater_command_service_test.dart` to validate command response handling.
- Created `store_tolerant_parsing_test.dart` to ensure stores skip malformed records gracefully.
- Cleared untranslated JSON file for localization updates.
This commit is contained in:
Zach committed 2026-09-25 10:01:18 -07:00
1 parent d5f54dfa11
commit d74587c167
105 files changed
+6419 -2072

No files matched your search

+49
View File
@@ -956,6 +956,55 @@ void main() {
});
});
group('oversized data body', () {
test('a 159-byte data body is rejected and parity cannot overrun', () {
final failed = <ImageReassemblyFailure>[];
final r = ImageReassembler(onFailed: failed.add);
// Header: sender 0x1234, img 5, idx 0 of 2; body one byte past the cap.
final oversized = Uint8List.fromList(<int>[
0x12,
0x34,
5,
(0 << 4) | 2,
...List<int>.filled(kImageChunkBodyBytes + 1, 0xAA),
]);
expect(oversized.length, kImageChunkBlobBytes);
expect(r.addChunk(oversized).status, ImageChunkStatus.malformed);
expect(r.pendingCount, 0);
// A parity chunk for the same stream must not throw.
final parity = Uint8List.fromList(<int>[
0x12,
0x34,
5,
(2 << 4) | 2,
...List<int>.filled(kImageChunkBodyBytes + 1, 0x55),
]);
expect(() => r.addChunk(parity), returnsNormally);
});
});
group('clear()', () {
test('reports in-progress streams as failed (disconnected)', () {
final failed = <ImageReassemblyFailure>[];
final r = ImageReassembler(onFailed: failed.add);
final set = buildImageChunks(
payload: payloadOf(400, seed: 3),
metadata: stdMeta,
senderPrefix: senderA,
imgId: 8,
);
r.addChunk(set.blobs[0]);
expect(r.pendingCount, 1);
r.clear();
expect(r.pendingCount, 0);
expect(failed, hasLength(1));
expect(failed.single.reason, ImageReassemblyFailureReason.disconnected);
expect(failed.single.isCorrupt, isFalse);
expect(r.evictExpired(now: DateTime(2100)), isEmpty);
});
});
group('completed-image map is capped', () {
/// A lone parity chunk of a `total == 1` image completes that image by
/// itself — one packet, one remembered entry. That is the amplification the