ModernMemoires/test/custom_divider_widget_test....

31 lines
902 B
Dart
Raw Permalink Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:moody/views/settings_page/widgets/custom_divider_widget.dart';
void main() {
testWidgets('CustomDivider has correct color, thickness, and height', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
body: CustomDivider(),
),
));
// Find the Divider widget.
final dividerFinder = find.byType(Divider);
expect(dividerFinder, findsOneWidget);
// Evaluate the Divider widget to check its properties.
final Divider divider = tester.firstWidget(dividerFinder) as Divider;
// Check for color
expect(divider.color, Colors.grey.shade300);
// Check for thickness
expect(divider.thickness, 1);
// Check for height
expect(divider.height, 1);
});
}