mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Remove 100ms BLE command delay
This commit is contained in:
@@ -2,6 +2,29 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meshcore_sar_app/models/message_reception_details.dart';
|
||||
|
||||
void main() {
|
||||
test('drops impossible transmit estimate for received messages', () {
|
||||
expect(
|
||||
sanitizeEstimatedTransmitMs(
|
||||
estimatedTransmitMs: 16 * 60 * 1000 + 54 * 1000,
|
||||
senderToReceiptMs: 4200,
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'keeps close transmit estimate despite second-level timestamp rounding',
|
||||
() {
|
||||
expect(
|
||||
sanitizeEstimatedTransmitMs(
|
||||
estimatedTransmitMs: 1800,
|
||||
senderToReceiptMs: 900,
|
||||
),
|
||||
1800,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test('round trips reception details json', () {
|
||||
final details = MessageReceptionDetails(
|
||||
capturedAt: DateTime.fromMillisecondsSinceEpoch(1700000000000),
|
||||
|
||||
@@ -47,9 +47,8 @@ void main() {
|
||||
expect(ok, isFalse);
|
||||
});
|
||||
|
||||
test('sends only requested indices and waits for ack', () async {
|
||||
test('sends only requested indices', () async {
|
||||
final sent = <Uint8List>[];
|
||||
final waited = <int>[];
|
||||
final ok = await serveCachedSessionFragments<_Fragment>(
|
||||
providerLabel: 'TestProvider',
|
||||
sessionId: 'deadbeef',
|
||||
@@ -70,15 +69,6 @@ void main() {
|
||||
}) async {
|
||||
sent.add(payload);
|
||||
},
|
||||
waitForFragmentAck:
|
||||
({
|
||||
required sessionId,
|
||||
required index,
|
||||
timeout = const Duration(seconds: 8),
|
||||
}) async {
|
||||
waited.add(index);
|
||||
return true;
|
||||
},
|
||||
requestedIndices: {1, 2},
|
||||
);
|
||||
|
||||
@@ -86,37 +76,6 @@ void main() {
|
||||
expect(sent.length, equals(2));
|
||||
expect(sent[0], equals(Uint8List.fromList([20])));
|
||||
expect(sent[1], equals(Uint8List.fromList([30])));
|
||||
expect(waited, equals([1, 2]));
|
||||
});
|
||||
|
||||
test('fails when ack does not arrive', () async {
|
||||
final ok = await serveCachedSessionFragments<_Fragment>(
|
||||
providerLabel: 'TestProvider',
|
||||
sessionId: 'deadbeef',
|
||||
requester: _buildContact(outPathLen: 1),
|
||||
fragments: [
|
||||
_Fragment(0, Uint8List.fromList([1])),
|
||||
],
|
||||
maxDirectPayloadHops: 3,
|
||||
indexOf: (f) => f.index,
|
||||
encodeBinary: (f) => f.payload,
|
||||
sendRawPacket:
|
||||
({
|
||||
required contactPath,
|
||||
required contactPathLen,
|
||||
required payload,
|
||||
}) async {},
|
||||
waitForFragmentAck:
|
||||
({
|
||||
required sessionId,
|
||||
required index,
|
||||
timeout = const Duration(seconds: 8),
|
||||
}) async {
|
||||
return false;
|
||||
},
|
||||
);
|
||||
|
||||
expect(ok, isFalse);
|
||||
});
|
||||
|
||||
test('fails when no requested index matches cached fragments', () async {
|
||||
|
||||
Reference in New Issue
Block a user