cpd_2022_zi/test/widget_tests/widget_entry_detail_test.dart

42 lines
1.1 KiB
Dart
Raw Normal View History

2023-03-06 21:04:35 +01:00
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:smoke_cess_app/widgets/entry_detail_widget.dart';
void main() {
initializeDateFormatting('de');
testWidgets('Entry Detail should use ExpansionTile if Comments is set',
(WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: EntryDetail(
date: DateTime.now(),
entryComment: 'A comment',
entryData: 'Test',
iconData: Icons.plus_one,
),
)),
);
expect(find.byType(ExpansionTile), findsOneWidget);
});
testWidgets('Entry Detail should use ListTile if Comments is null',
(WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: EntryDetail(
date: DateTime.now(),
entryComment: 'A comment',
entryData: 'Test',
iconData: Icons.plus_one,
),
)),
);
expect(find.byType(ListTile), findsOneWidget);
});
}