29 lines
943 B
Dart
29 lines
943 B
Dart
|
|
import "package:flutter/material.dart";
|
||
|
|
import "package:flutter_test/flutter_test.dart";
|
||
|
|
import "package:qr_flutter/qr_flutter.dart";
|
||
|
|
|
||
|
|
import "package:smol_mail/presentation/theme/theme.dart";
|
||
|
|
import "package:smol_mail/presentation/widgets/qr_code_sheet.dart";
|
||
|
|
|
||
|
|
void main() {
|
||
|
|
testWidgets("the sheet renders the payload as a scannable QR code",
|
||
|
|
(tester) async {
|
||
|
|
const payload = "smol://alice@example.org/lm2gqd7e5q67xq3isc5hx6jfj2q7a7xvq4l7trctxipudujovmgq";
|
||
|
|
await tester.pumpWidget(
|
||
|
|
MaterialApp(
|
||
|
|
theme: appThemeLight,
|
||
|
|
home: Builder(
|
||
|
|
builder: (context) => TextButton(
|
||
|
|
onPressed: () => showQrCodeSheet(context, payload),
|
||
|
|
child: const Text("show"),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
await tester.tap(find.text("show"));
|
||
|
|
await tester.pumpAndSettle();
|
||
|
|
expect(find.byType(QrImageView), findsOneWidget);
|
||
|
|
expect(find.text(payload), findsOneWidget);
|
||
|
|
});
|
||
|
|
}
|