Files
pipelines/app/test/features/settings/settings_library_test.dart
T
alan 1e07ab1ddc Remove Templates from Settings
Keep the Templates destination available through its direct routes while removing the obsolete Settings entry and wiring. Update navigation coverage and document the preserved route behavior.
2026-11-12 01:02:11 +00:00

67 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/transport/pipelines_client.dart'
as transport;
import 'package:pipelines_app/features/settings/settings_keys.dart';
import 'package:pipelines_app/features/settings/settings_screen.dart';
import 'package:pipelines_app/features/settings/settings_store.dart';
import 'fake_channel.dart';
import 'settings_topic_test_helper.dart';
/// The Tools topic's Library group lists Schedules only: Templates left
/// Settings, and Schedules keeps its own route.
void main() {
Future<void> pump(
WidgetTester tester, {
VoidCallback? onOpenSchedules,
}) async {
await tester.binding.setSurfaceSize(const Size(560, 1000));
addTearDown(() => tester.binding.setSurfaceSize(null));
final factory = FakeChannelFactory();
final client = transport.PipelinesClient(channelFactory: factory.call);
addTearDown(client.dispose);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SettingsScreen(
client: client,
store: MemorySettingsStore(),
embedded: true,
onOpenSchedules: onOpenSchedules,
),
),
),
);
await tester.pump();
await selectSettingsTopic(tester, 'Tools');
}
testWidgets('Tools offers Schedules and no Templates entry', (tester) async {
var opened = 0;
await pump(tester, onOpenSchedules: () => opened++);
expect(find.text('Library'), findsOneWidget);
expect(find.text('Browse templates'), findsNothing);
expect(
find.byKey(const ValueKey<String>('settings.templates')),
findsNothing,
);
await tester.ensureVisible(find.byKey(SettingsKeys.schedules));
await tester.tap(find.byKey(SettingsKeys.schedules));
await tester.pump();
expect(opened, 1);
});
testWidgets('without a Schedules route the Library group is absent', (
tester,
) async {
await pump(tester);
expect(find.text('Library'), findsNothing);
expect(find.text('Browse templates'), findsNothing);
expect(find.byKey(SettingsKeys.schedules), findsNothing);
});
}