forked from eatvio/eatvio_app
chore(dependencies): add webview_flutter_platform_interface package to pubspec.yaml and clean up test files by removing unnecessary whitespace
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/payment_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../../../helpers/webview_test_helper.dart';
|
||||
|
||||
void main() {
|
||||
setUp(() {
|
||||
WebViewTestHelper.setUpWebViewPlatform();
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
WebViewTestHelper.tearDownWebViewPlatform();
|
||||
});
|
||||
|
||||
group('PaymentScreen', () {
|
||||
testWidgets('отображает PaymentScreen с WebView и AppBar', (WidgetTester tester) async {
|
||||
const url = 'https://example.com/payment';
|
||||
const planId = 1;
|
||||
|
||||
final router = GoRouter(
|
||||
initialLocation: '/',
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => const PaymentScreen(url: url, planId: planId),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp.router(
|
||||
routerConfig: router,
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pump();
|
||||
|
||||
// Проверяем, что экран отображается
|
||||
expect(find.byType(PaymentScreen), findsOneWidget);
|
||||
expect(find.byType(Scaffold), findsOneWidget);
|
||||
expect(find.byType(AppBar), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('PaymentScreen создается с правильными параметрами', (WidgetTester tester) async {
|
||||
const url = 'https://example.com/payment/test';
|
||||
const planId = 42;
|
||||
|
||||
final router = GoRouter(
|
||||
initialLocation: '/',
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => const PaymentScreen(url: url, planId: planId),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp.router(
|
||||
routerConfig: router,
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(PaymentScreen), findsOneWidget);
|
||||
});
|
||||
|
||||
test('PaymentScreen имеет правильные статические константы', () {
|
||||
expect(PaymentScreen.name, 'paymentScreen');
|
||||
expect(PaymentScreen.path, '/payment-screen');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user