parent
1defa889dc
commit
64b58d03a4
@ -0,0 +1,14 @@ |
|||||||
|
// ignore_for_file: invalid_use_of_protected_member |
||||||
|
|
||||||
|
import 'package:flutter_test/flutter_test.dart'; |
||||||
|
import 'package:thesis_shop/stores/cart_store.dart'; |
||||||
|
|
||||||
|
import 'product_service_mock.dart'; |
||||||
|
|
||||||
|
void main() { |
||||||
|
test('test cart store', () { |
||||||
|
final cartStore = CartStore(); |
||||||
|
cartStore.increaseAmountOfProduct(demoProducts.first); |
||||||
|
expect(cartStore.state[demoProducts.first.title], 1); |
||||||
|
}); |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
import 'package:flutter/material.dart'; |
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart'; |
||||||
|
import 'package:flutter_test/flutter_test.dart'; |
||||||
|
import 'package:thesis_shop/screens/cart/total_price_text.dart'; |
||||||
|
import 'package:thesis_shop/stores/cart_store.dart'; |
||||||
|
|
||||||
|
void main() { |
||||||
|
testWidgets('test total price widget', (tester) async { |
||||||
|
await tester.pumpWidget( |
||||||
|
MaterialApp( |
||||||
|
home: ProviderScope( |
||||||
|
overrides: [ |
||||||
|
totalPriceProvider.overrideWithValue(10.0), |
||||||
|
], |
||||||
|
child: const TotalPriceText(), |
||||||
|
), |
||||||
|
), |
||||||
|
); |
||||||
|
expect(find.text('Gesamtpreis: 10.00€'), findsOneWidget); |
||||||
|
}); |
||||||
|
} |
Loading…
Reference in new issue