A whole lot of stuff

This commit is contained in:
Courtney Arnold 2026-08-18 11:04:58 -05:00
parent faf319322a
commit ad850d2be6
50 changed files with 3013 additions and 213 deletions

View file

@ -65,6 +65,69 @@ void main() {
expect(find.text('Red Truck'), findsOneWidget);
});
testWidgets(
'shows an estimated fuel refund in the hero banner and next to each row\'s gallons '
'when the setting is on', (tester) async {
final entry = FuelEntry(
id: 'e1',
vehicleId: 'v1',
date: DateTime(2026, 5, 14),
gallons: 10.523,
pricePerGallon: 3.5,
totalCost: 32.48,
updatedAt: DateTime.utc(2026, 5, 14),
receiptDriveFileId: 'remote-1',
);
final appState = AppState()
..isLoading = false
..vehicles = [vehicle]
..fuelEntries = [entry]
..showEstimatedFuelRefund = true;
await tester.pumpWidget(
ChangeNotifierProvider.value(
value: appState,
child: const MaterialApp(home: ReceiptsScreen()),
),
);
expect(find.text('Est. Refund'), findsOneWidget, reason: 'replaces the hero icon');
// 10.523 gal rounds up to 11, * $0.125/gal = $1.375, floored to $1.37 —
// the hero's own standalone stat value...
expect(find.text('\$1.37'), findsOneWidget);
// ...and the same figure again, folded into the row's combined text.
expect(find.textContaining('10.523 gal · Est. \$1.37'), findsOneWidget);
});
testWidgets("doesn't show an estimated fuel refund anywhere when the setting is off (default)",
(tester) async {
final entry = FuelEntry(
id: 'e1',
vehicleId: 'v1',
date: DateTime(2026, 5, 14),
gallons: 10.523,
pricePerGallon: 3.5,
totalCost: 32.48,
updatedAt: DateTime.utc(2026, 5, 14),
receiptDriveFileId: 'remote-1',
);
final appState = AppState()
..isLoading = false
..vehicles = [vehicle]
..fuelEntries = [entry];
await tester.pumpWidget(
ChangeNotifierProvider.value(
value: appState,
child: const MaterialApp(home: ReceiptsScreen()),
),
);
expect(appState.showEstimatedFuelRefund, isFalse, reason: 'off by default');
expect(find.text('Est. Refund'), findsNothing);
expect(find.textContaining('Est. \$'), findsNothing);
});
testWidgets('tapping a receipted row opens the receipt detail page', (tester) async {
final entry = FuelEntry(
id: 'e1',