- Manual path trace validates the request that will actually be sent (round trips become 2n-1 hops, 3-byte hops go out as 4-byte prefixes) against the 172-byte frame and 64-hop firmware limits, and disables Run with an explanation when it does not fit. PathTraceMapScreen also refuses to send an oversized request. - Contact-share tokens are never passed through message translation, so the share cannot be mangled before sending.
36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:meshcore_open/services/app_settings_service.dart';
|
|
import 'package:meshcore_open/services/translation_service.dart';
|
|
import 'package:meshcore_open/storage/prefs_manager.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
void main() {
|
|
TestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
test('outgoing translation skips contact-share tokens', () async {
|
|
SharedPreferences.setMockInitialValues({});
|
|
await PrefsManager.initialize();
|
|
final settings = AppSettingsService();
|
|
await settings.loadSettings();
|
|
await settings.setComposerTranslationEnabled(true);
|
|
final translation = TranslationService(settings);
|
|
const token =
|
|
'<50ba28f599799142622d188469a63f3890d495cdcedd24239052abd364c0283d:1:CC>';
|
|
|
|
expect(
|
|
translation.shouldTranslateOutgoing(
|
|
text: token,
|
|
targetLanguageCode: 'de',
|
|
),
|
|
isFalse,
|
|
);
|
|
expect(
|
|
translation.shouldTranslateOutgoing(
|
|
text: 'hello there',
|
|
targetLanguageCode: 'de',
|
|
),
|
|
isTrue,
|
|
);
|
|
});
|
|
}
|