added categories, import export, settings
This commit is contained in:
+25
-3
@@ -6,7 +6,9 @@ import 'package:receipity/review_screen.dart';
|
||||
import 'package:receipity/services/product_repository.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('scan screen shows capture actions', (tester) async {
|
||||
testWidgets('scan screen shows capture actions and bottom navigation', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(ReceipityApp());
|
||||
|
||||
expect(find.text('Receipity'), findsOneWidget);
|
||||
@@ -17,6 +19,9 @@ void main() {
|
||||
find.textContaining('Take a photo of a shopping receipt'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('Products'), findsOneWidget);
|
||||
expect(find.text('Scan'), findsOneWidget);
|
||||
expect(find.text('Shop log'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('review screen lists items and can delete one', (tester) async {
|
||||
@@ -28,7 +33,7 @@ void main() {
|
||||
LineItem(id: '2', name: 'Bread', price: 2),
|
||||
],
|
||||
rawText: 'Milk 1.50\nBread 2.00',
|
||||
repository: ProductRepository(),
|
||||
repository: ProductRepository(databasePath: ':memory:'),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -36,11 +41,28 @@ void main() {
|
||||
expect(find.text('Milk'), findsOneWidget);
|
||||
expect(find.text('Bread'), findsOneWidget);
|
||||
expect(find.text('Add item'), findsOneWidget);
|
||||
expect(find.text('Confirm'), findsOneWidget);
|
||||
expect(find.textContaining('Save trip'), findsOneWidget);
|
||||
expect(find.text('Supermarket'), findsOneWidget);
|
||||
|
||||
await tester.drag(find.text('Milk'), const Offset(-500, 0));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Milk'), findsNothing);
|
||||
expect(find.text('Bread'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('review screen preselects a supermarket from OCR text', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: ReviewScreen(
|
||||
items: [LineItem(id: '1', name: 'Milk', price: 1.5)],
|
||||
rawText: 'Jumbo\nMilk 1.50',
|
||||
repository: ProductRepository(databasePath: ':memory:'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('Jumbo'), findsWidgets);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user