feat: Add channel datagrams #1928

ref:
This commit is contained in:
Janez T
2026-03-22 16:46:58 +01:00
parent ab05f13de9
commit 71eac21df9
11 changed files with 541 additions and 1237 deletions

View File

@@ -0,0 +1,40 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:meshcore_sar_app/services/location_tracking_service.dart';
import 'package:meshcore_sar_app/services/profiles_feature_service.dart';
void main() {
final service = LocationTrackingService();
setUp(() {
SharedPreferences.setMockInitialValues({});
ProfileStorageScope.setScope(
profilesEnabled: false,
activeProfileId: 'default',
);
service.fastLocationUpdatesEnabled = false;
service.fastLocationMovementThresholdMeters = 10.0;
service.fastLocationActiveCadenceSeconds = 10;
service.fastLocationChannelIdx = null;
});
test('persists and restores fast location channel idx', () async {
await service.updateFastLocationChannelIdx(3);
service.fastLocationChannelIdx = null;
await service.loadSettings();
expect(service.fastLocationChannelIdx, 3);
});
test('clears persisted fast location channel idx when unset', () async {
await service.updateFastLocationChannelIdx(7);
await service.updateFastLocationChannelIdx(null);
service.fastLocationChannelIdx = 99;
await service.loadSettings();
expect(service.fastLocationChannelIdx, isNull);
});
}