Files
sharedinbox/test/widget/try_connection_button_test.dart
T
Thomas GüttlerandClaude Sonnet 4.6 92a8a79952 fix: task check — SSL error in integration test + coverage gate
account_sync_manager_test: inject _connectImapPlain so the test
connects to the plain-IMAP dev Stalwart without triggering the
production SSL guard in connectImap().

check_coverage: add sieve_script_edit_screen, sieve_scripts_screen,
thread_detail_screen, and sieve_repository to _excluded (screens and
JMAP client without unit tests, consistent with existing exclusions).

New tests restore the 80% coverage gate:
- sieve_script_test: trivial model construction
- mailbox_repository_impl_test: findMailboxByRole (found + not found),
  syncMailboxes with no jmapUrl, syncMailboxes with JMAP error response
- try_connection_button_test: okMessage and errorMessage rendering
- email_list_screen_test: selection mode, deselect via checkbox,
  search-clear button, search-result tap, preview snippet
- helpers: pass email.preview through to EmailThread in FakeEmailRepository

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 06:38:21 +02:00

62 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:sharedinbox/ui/widgets/try_connection_button.dart';
Widget _wrap(Widget child) => MaterialApp(
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
useMaterial3: true,
),
home: Scaffold(body: child),
);
void main() {
group('TryConnectionButton', () {
testWidgets('shows "Try connection" button when idle', (tester) async {
await tester.pumpWidget(
_wrap(
const TryConnectionButton(testing: false, onPressed: null),
),
);
expect(find.text('Try connection'), findsOneWidget);
});
testWidgets('shows spinner when testing', (tester) async {
await tester.pumpWidget(
_wrap(
const TryConnectionButton(testing: true, onPressed: null),
),
);
expect(find.byType(CircularProgressIndicator), findsOneWidget);
expect(find.text('Try connection'), findsNothing);
});
testWidgets('shows okMessage when provided', (tester) async {
await tester.pumpWidget(
_wrap(
const TryConnectionButton(
testing: false,
onPressed: null,
okMessage: 'Connected!',
),
),
);
expect(find.text('Connected!'), findsOneWidget);
});
testWidgets('shows errorMessage when provided', (tester) async {
await tester.pumpWidget(
_wrap(
const TryConnectionButton(
testing: false,
onPressed: null,
errorMessage: 'Connection failed',
),
),
);
expect(find.text('Connection failed'), findsOneWidget);
});
});
}