Files
sharedinbox/test/widget/sieve_scripts_screen_test.dart
T
Thomas SharedInboxandClaude Sonnet 4.6 dc8c1cb08d feat: introduce Local Filters / Remote Filters terminology (#109)
- Rename 'Local email filters' → 'Local Filters' and 'Server email
  filters' → 'Remote Filters' in AppBar titles
- Update banner text on each filter page to focus on the current type
  and mention that the other type exists separately
- Add 'Remote Filters' and 'Local Filters' as two distinct drawer
  entries so both types are discoverable from the navigation
- Add widget tests verifying titles and banner text for both pages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 01:49:11 +02:00

77 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:http/http.dart' as http;
import 'package:sharedinbox/core/models/sieve_script.dart';
import 'package:sharedinbox/data/db/local_sieve_repository.dart';
import 'package:sharedinbox/data/jmap/sieve_repository.dart';
import 'package:sharedinbox/di.dart';
import 'package:sharedinbox/ui/screens/sieve_scripts_screen.dart';
import '../unit/db_test_helper.dart';
import 'helpers.dart';
class _FakeSieveRepository extends SieveRepository {
_FakeSieveRepository() : super(FakeAccountRepository(), http.Client());
@override
Future<List<SieveScript>> listScripts(String accountId) async => [];
}
void main() {
configureSqliteForTests();
testWidgets('Remote Filters page shows correct title and banner', (
tester,
) async {
await tester.pumpWidget(
ProviderScope(
overrides: [
sieveRepositoryProvider.overrideWith(
(ref) => _FakeSieveRepository(),
),
],
child: const MaterialApp(
home: SieveScriptsScreen(accountId: 'acc-1'),
),
),
);
await tester.pumpAndSettle();
expect(find.text('Remote Filters'), findsOneWidget);
expect(
find.textContaining('Remote Filters run Sieve scripts'),
findsOneWidget,
);
expect(find.textContaining('Local Filters'), findsOneWidget);
});
testWidgets('Local Filters page shows correct title and banner', (
tester,
) async {
final db = openTestDatabase();
addTearDown(db.close);
await tester.pumpWidget(
ProviderScope(
overrides: [
localSieveRepositoryProvider.overrideWith(
(ref) => LocalSieveRepository(db),
),
],
child: const MaterialApp(
home: SieveScriptsScreen(accountId: 'acc-1', isLocal: true),
),
),
);
await tester.pumpAndSettle();
expect(find.text('Local Filters'), findsOneWidget);
expect(
find.textContaining('Local Filters run Sieve scripts'),
findsOneWidget,
);
expect(find.textContaining('Remote Filters'), findsOneWidget);
});
}