| 123456789101112131415161718192021222324252627282930313233 |
- import 'package:cardash_launcher/core/theme/app_theme.dart';
- import 'package:cardash_launcher/features/home/widgets/obd_card.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_test/flutter_test.dart';
- void main() {
- testWidgets('OBD card renders speed, throttle and economy', (tester) async {
- await tester.pumpWidget(
- MaterialApp(
- theme: AppTheme.dark(),
- home: const Scaffold(
- body: Center(
- child: SizedBox(
- width: 380,
- child: ObdCard(
- speedKmh: 44,
- throttlePercent: 22,
- economyL100: 7.5,
- ),
- ),
- ),
- ),
- ),
- );
- await tester.pump(const Duration(milliseconds: 250));
- expect(tester.takeException(), isNull);
- expect(find.text('44'), findsOneWidget);
- expect(find.text('km/h'), findsOneWidget);
- expect(find.text('Throttle'), findsOneWidget);
- expect(find.text('7.5 L/100 km'), findsOneWidget);
- });
- }
|