From 5dcd76a9a9e7ca896ea9781972adafcf72a140b7 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Mon, 11 May 2026 22:23:17 +0200 Subject: [PATCH] test sweep: cover builtin/ipc_status (T-91) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four new widget tests in test/builtin/ipc_status/widget_test.dart covering the toolchain-state branches of ToolStatusItem and the StatusItemContribution build callback: - unresolved toolchain → SizedBox.shrink (no chip text rendered) - all tools resolved → single "application ok" chip - some tools missing → one warning chip per missing tool - StatusItemContribution.build returns a ToolStatusItem widget Coverage: builtin/ipc_status/src/status_item.dart 9/22 -> 22/22; builtin/ipc_status/src/extension.dart 6/7 -> 7/7. Both at 100%. Total 73.88% -> 73.99%. Co-Authored-By: Claude Opus 4.7 (1M context) --- test/builtin/ipc_status/widget_test.dart | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/test/builtin/ipc_status/widget_test.dart b/test/builtin/ipc_status/widget_test.dart index 293e8eb8..c241ff8b 100644 --- a/test/builtin/ipc_status/widget_test.dart +++ b/test/builtin/ipc_status/widget_test.dart @@ -1,6 +1,7 @@ import 'package:clide/builtin/ipc_status/ipc_status.dart'; import 'package:clide/extension/extension.dart'; import 'package:clide/kernel/kernel.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../helpers/kernel_fixture.dart'; @@ -29,5 +30,53 @@ void main() { await tester.pumpAndSettle(); expect(tester.takeException(), isNull); }); + + testWidgets('unresolved toolchain renders an empty shrink', (tester) async { + // Default fixture leaves toolchain unresolved → SizedBox.shrink branch. + await tester.pumpWidget(harness(f, const ToolStatusItem())); + await tester.pumpAndSettle(); + expect(find.text('application ok'), findsNothing); + }); + + testWidgets('all-tools-resolved shows a single "application ok" chip', (tester) async { + f.services.toolchain.applyResolved(const ResolvedPaths( + git: '/usr/bin/git', + pql: '/usr/bin/pql', + tmux: '/usr/bin/tmux', + shell: '/bin/bash', + )); + await tester.pumpWidget(harness(f, const ToolStatusItem())); + await tester.pumpAndSettle(); + expect(find.text('application ok'), findsOneWidget); + }); + + testWidgets('missing tools render a warning chip per missing tool', (tester) async { + // git + tmux missing, pql resolved. + f.services.toolchain.applyResolved(const ResolvedPaths( + pql: '/usr/bin/pql', + shell: '/bin/bash', + )); + await tester.pumpWidget(harness(f, const ToolStatusItem())); + await tester.pumpAndSettle(); + expect(find.text('git not found'), findsOneWidget); + expect(find.text('tmux not found'), findsOneWidget); + expect(find.text('pql not found'), findsNothing); + }); + + testWidgets('StatusItemContribution.build returns a ToolStatusItem', (tester) async { + f.services.extensions.register(IpcStatusExtension()); + await f.services.extensions.activateAll(); + final item = f.services.panels.contributionsFor(Slots.statusbar).whereType().first; + // Pump a Builder so we have a real BuildContext to hand to .build. + late Widget produced; + await tester.pumpWidget(harness( + f, + Builder(builder: (ctx) { + produced = item.build(ctx); + return const SizedBox.shrink(); + }), + )); + expect(produced, isA()); + }); }); }