33 lines
1.2 KiB
Dart
33 lines
1.2 KiB
Dart
// This is a basic Flutter widget test.
|
|
//
|
|
// To perform an interaction with a widget in your test, use the WidgetTester
|
|
// utility in the flutter_test package. For example, you can send tap and scroll
|
|
// gestures. You can also use WidgetTester to find child widgets in the widget
|
|
// tree, read text, and verify that the values of widget properties are correct.
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:motorcycle_dash/main.dart';
|
|
import 'package:motorcycle_dash/features/records/records_service.dart';
|
|
|
|
void main() {
|
|
testWidgets('App starts without crashing', (WidgetTester tester) async {
|
|
// We need to mock SharedPreferences for the provider
|
|
SharedPreferences.setMockInitialValues({});
|
|
final sharedPreferences = await SharedPreferences.getInstance();
|
|
|
|
await tester.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
sharedPreferencesProvider.overrideWithValue(sharedPreferences),
|
|
],
|
|
child: const MotorcycleDashApp(),
|
|
),
|
|
);
|
|
|
|
// Verify it doesn't crash
|
|
expect(find.byType(MotorcycleDashApp), findsOneWidget);
|
|
});
|
|
}
|