33 lines
937 B
Dart
33 lines
937 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:garden_planner/repositories/beet.repositories.dart';
|
|
import 'package:garden_planner/widgets/sidebar.dart';
|
|
|
|
import '../helpers/beet_repository_generator.dart';
|
|
|
|
void main() {
|
|
testWidgets('Sidebar widget displays all items', (WidgetTester tester) async {
|
|
//Arrange
|
|
BeetRepository repo = BeetRepositoryGenerator.getBeetRepository();
|
|
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: Scaffold(
|
|
body: Sidebar(
|
|
beetRepository: repo,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
//Act
|
|
await tester.pumpAndSettle(const Duration(seconds: 5));
|
|
|
|
//Assert
|
|
expect(find.text('Verfügbare Pflanzen'), findsOneWidget);
|
|
expect(find.byType(Divider), findsOneWidget);
|
|
expect(find.byType(Image), findsNWidgets(2),
|
|
reason: 'The image of the plants should be displayed');
|
|
});
|
|
}
|