28 lines
1.0 KiB
Dart
28 lines
1.0 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_test/flutter_test.dart';
|
||
|
import 'package:moody/main.dart';
|
||
|
import 'package:moody/utils/slide_direction.dart';
|
||
|
import 'package:moody/views/settings_page/settings_page.dart';
|
||
|
|
||
|
void main() {
|
||
|
// Test for basic rendering of MyApp
|
||
|
testWidgets('MyApp renders correctly', (WidgetTester tester) async {
|
||
|
await tester.pumpWidget(const MyApp());
|
||
|
expect(find.byType(MaterialApp), findsOneWidget);
|
||
|
});
|
||
|
|
||
|
// Test for route configuration
|
||
|
testWidgets('Navigating to /settings shows SettingsPage', (WidgetTester tester) async {
|
||
|
await tester.pumpWidget(const MyApp());
|
||
|
await tester.tap(find.text('Settings'));
|
||
|
await tester.pumpAndSettle();
|
||
|
expect(find.byType(SettingsPage), findsOneWidget);
|
||
|
});
|
||
|
|
||
|
// Test for custom logic - determineSlideDirection
|
||
|
test('determineSlideDirection returns correct SlideDirection', () {
|
||
|
expect(determineSlideDirection('/', '/settings'), equals(SlideDirection.left));
|
||
|
// Add more test cases for different route combinations
|
||
|
});
|
||
|
}
|