import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:tane/i18n/strings.g.dart'; import 'package:tane/services/social_service.dart'; import 'package:tane/services/social_settings.dart'; import 'package:tane/ui/chat_screen.dart'; import '../support/test_support.dart'; void main() { testWidgets('with no relay configured, chat shows the offline note', (tester) async { final social = await SocialService.fromRootSeedHex('00' * 32); final settings = SocialSettings(InMemorySecretStore()); await settings.setRelayUrls(const []); // offline: don't hit the network LocaleSettings.setLocaleSync(AppLocale.en); await tester.pumpWidget( TranslationProvider( child: MaterialApp( locale: AppLocale.en.flutterLocale, supportedLocales: AppLocaleUtils.supportedLocales, localizationsDelegates: const [ GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], home: ChatScreen( social: social, settings: settings, peerPubkey: 'ab' * 32, ), ), ), ); await tester.pumpAndSettle(); expect(find.text('Set up sharing to send messages'), findsOneWidget); }); }