forked from eatvio/eatvio_app
66 lines
1.5 KiB
Dart
66 lines
1.5 KiB
Dart
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|
import 'package:eatvio_app/features/diary/presentation/widgets/comment_container.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
group('CommentContainer', () {
|
|
testWidgets('displays comment text', (tester) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: ThemeHelper().themeData(),
|
|
home: const Scaffold(
|
|
body: CommentContainer(comment: 'Test comment'),
|
|
),
|
|
),
|
|
);
|
|
|
|
expect(find.byType(CommentContainer), findsOneWidget);
|
|
expect(find.text('Test comment'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('displays empty comment', (tester) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: ThemeHelper().themeData(),
|
|
home: const Scaffold(
|
|
body: CommentContainer(comment: ''),
|
|
),
|
|
),
|
|
);
|
|
|
|
expect(find.byType(CommentContainer), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('displays long comment', (tester) async {
|
|
const longComment = 'This is a very long comment that should be displayed properly in the container';
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: ThemeHelper().themeData(),
|
|
home: const Scaffold(
|
|
body: CommentContainer(comment: longComment),
|
|
),
|
|
),
|
|
);
|
|
|
|
expect(find.byType(CommentContainer), findsOneWidget);
|
|
expect(find.text(longComment), findsOneWidget);
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|