From afa52f0ad31b5de2aeeaeb6466afc024ed9b64a4 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Thu, 15 Feb 2024 11:56:48 -0800 Subject: [PATCH] add tests for `SendConfirmationPage` --- .../send/send_confirmation_page_test.dart | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/features/send/send_confirmation_page_test.dart diff --git a/test/features/send/send_confirmation_page_test.dart b/test/features/send/send_confirmation_page_test.dart new file mode 100644 index 00000000..daa30ccd --- /dev/null +++ b/test/features/send/send_confirmation_page_test.dart @@ -0,0 +1,35 @@ +import 'package:didpay/features/send/send_confirmation_page.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../../helpers/widget_helpers.dart'; + +void main() { + group('SendConfirmationPage', () { + testWidgets('should show sending payment', (tester) async { + await tester.runAsync(() async { + await tester.pumpWidget( + WidgetHelpers.testableWidget( + child: const SendConfirmationPage(did: '', amount: ''), + ), + ); + + expect(find.text('Sending payment...'), findsOneWidget); + expect(find.byType(CircularProgressIndicator), findsOneWidget); + }); + }); + + testWidgets('should show payment was sent', (tester) async { + await tester.pumpWidget( + WidgetHelpers.testableWidget( + child: const SendConfirmationPage(did: '', amount: ''), + ), + ); + + await tester.pumpAndSettle(); + + expect(find.text('Your payment was sent!'), findsOneWidget); + expect(find.byIcon(Icons.check_circle), findsOneWidget); + }); + }); +}