1
import 'dart:async';
2
import 'dart:io';
3
-import 'dart:typed_data';
3
4
import 'package:dio/dio.dart';
5
import 'package:flutter/material.dart';
22
import 'package:localmind/features/servers/providers/server_providers.dart';
23
import 'package:localmind/features/onboarding/screens/onboarding_server_setup_screen.dart';
24
import 'package:localmind/features/servers/views/add_server_screen.dart';
25
+import 'package:flutter_localizations/flutter_localizations.dart';
26
import 'package:localmind/features/settings/data/models/app_settings.dart';
27
+import 'package:localmind/features/sidebar/components/github_repo_card.dart';
28
import 'package:localmind/l10n/app_localizations.dart';
29
+import 'package:flutter/services.dart';
30
import 'package:shadcn_ui/shadcn_ui.dart';
31
import 'package:shared_preferences/shared_preferences.dart';
32
762
},
763
);
764
});
765
+
766
+ group('Issue #71: GitHub URL Launcher Safe Failure Handling', () {
767
+ testWidgets(
768
+ 'GitHubRepoCard does not throw an unhandled exception when tapped',
769
+ (tester) async {
770
+ // In the test environment there is no native URL launcher. The
771
+ // try/catch in _launchUrl must swallow any failure so the app
772
+ // does not crash — that is the regression guard for issue #71.
773
+ await tester.pumpWidget(
774
+ const MaterialApp(
775
+ localizationsDelegates: [
776
+ AppLocalizations.delegate,
777
+ GlobalMaterialLocalizations.delegate,
778
+ GlobalWidgetsLocalizations.delegate,
779
+ GlobalCupertinoLocalizations.delegate,
780
+ ],
781
+ supportedLocales: AppLocalizations.supportedLocales,
782
+ home: Scaffold(body: Center(child: GitHubRepoCard())),
783
+ ),
784
+ );
785
+ await tester.pumpAndSettle();
786
+
787
+ await tester.tap(find.byType(GitHubRepoCard));
788
+ await tester.pumpAndSettle();
789
+
790
+ expect(tester.takeException(), isNull);
791
+ },
792
+ );
793
+ });
794
}
795
796
class _MutableActiveServerNotifier extends ActiveServerNotifier {