You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.5 KiB
55 lines
1.5 KiB
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:mobx/src/api/observable_collections.dart';
|
|
import 'package:thesis_shop/models/cart_item.dart';
|
|
import 'package:thesis_shop/models/product.dart';
|
|
import 'package:thesis_shop/screens/cart/total_price_text.dart';
|
|
import 'package:thesis_shop/stores/cart_item_store.dart';
|
|
import 'package:thesis_shop/stores/cart_store.dart';
|
|
import 'package:thesis_shop/stores/store_injector.dart';
|
|
import 'package:thesis_shop/stores/user_store.dart';
|
|
|
|
import 'cart_store_test.dart';
|
|
|
|
class MockedCartStore implements CartStore {
|
|
@override
|
|
int amountOfProduct(Product product) {
|
|
throw UnimplementedError();
|
|
}
|
|
|
|
@override
|
|
ObservableList<CartItem> get cart => throw UnimplementedError();
|
|
|
|
@override
|
|
CartItemStore cartItemStoreOfProduct(Product product) {
|
|
throw UnimplementedError();
|
|
}
|
|
|
|
@override
|
|
void decrementAmountOfProduct(Product product) {}
|
|
|
|
@override
|
|
void incrementAmountOfProduct(Product product) {}
|
|
|
|
@override
|
|
int get numberOfItems => throw UnimplementedError();
|
|
|
|
@override
|
|
double get totalPrice => 10.0;
|
|
}
|
|
|
|
void main() {
|
|
testWidgets('test total price text', (tester) async {
|
|
await tester.pumpWidget(
|
|
StoreInjector(
|
|
userStore: UserStore(),
|
|
cartStore: MockedCartStore(),
|
|
productStore: MockedProductStore(),
|
|
child: const MaterialApp(
|
|
home: TotalPriceText(),
|
|
),
|
|
),
|
|
);
|
|
expect(find.text('Gesamtpreis: 10.00€'), findsOneWidget);
|
|
});
|
|
}
|
|
|