A whole lot of stuff
This commit is contained in:
parent
faf319322a
commit
ad850d2be6
50 changed files with 3013 additions and 213 deletions
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:fuel_tax_tracker/models/fuel_entry.dart';
|
||||
import 'package:fuel_tax_tracker/models/vehicle.dart';
|
||||
import 'package:fuel_tax_tracker/screens/vehicle_detail_screen.dart';
|
||||
import 'package:fuel_tax_tracker/services/app_state.dart';
|
||||
|
|
@ -85,4 +86,47 @@ void main() {
|
|||
|
||||
expect(find.widgetWithText(AppBar, 'Truck'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('shows an estimated fuel refund next to price/gal when the setting is on',
|
||||
(tester) async {
|
||||
final entry = FuelEntry(
|
||||
id: 'e1',
|
||||
vehicleId: 'a',
|
||||
date: DateTime(2026, 5, 14, 9, 30),
|
||||
gallons: 10,
|
||||
pricePerGallon: 3.5,
|
||||
totalCost: 35,
|
||||
updatedAt: DateTime.utc(2026, 5, 14),
|
||||
);
|
||||
final appState = AppState()
|
||||
..isLoading = false
|
||||
..vehicles = [vehicleA]
|
||||
..fuelEntries = [entry]
|
||||
..showEstimatedFuelRefund = true;
|
||||
|
||||
await pumpDetail(tester, appState, 'a');
|
||||
|
||||
// 10 gal * $0.125/gal = $1.25.
|
||||
expect(find.textContaining('\$3.50/gal · Est. \$1.25'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('shows no estimated fuel refund when the setting is off (default)', (tester) async {
|
||||
final entry = FuelEntry(
|
||||
id: 'e1',
|
||||
vehicleId: 'a',
|
||||
date: DateTime(2026, 5, 14, 9, 30),
|
||||
gallons: 10,
|
||||
pricePerGallon: 3.5,
|
||||
totalCost: 35,
|
||||
updatedAt: DateTime.utc(2026, 5, 14),
|
||||
);
|
||||
final appState = AppState()
|
||||
..isLoading = false
|
||||
..vehicles = [vehicleA]
|
||||
..fuelEntries = [entry];
|
||||
|
||||
await pumpDetail(tester, appState, 'a');
|
||||
|
||||
expect(find.textContaining('Est. \$'), findsNothing);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue