From 8a9167bdfd51387c5dffa56837dbb178d6c6b991 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sun, 28 Jun 2026 01:19:50 +0200 Subject: [PATCH] test(claude): cover remove-nonexistent + list live-update for the 95% margin Two more real branches the account feature left uncovered: removing an unregistered account (the no-such-account error) and the registry list rebuilding when a CLI-side registration notifies the shared settings store. Co-Authored-By: Claude Opus 4.8 (1M context) --- test/builtin/claude/account_settings_control_test.dart | 7 ++++++- test/daemon/claude_account_commands_test.dart | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/test/builtin/claude/account_settings_control_test.dart b/test/builtin/claude/account_settings_control_test.dart index d6df4ce8..2b526c12 100644 --- a/test/builtin/claude/account_settings_control_test.dart +++ b/test/builtin/claude/account_settings_control_test.dart @@ -114,13 +114,18 @@ void main() { expect(find.text('Add account'), findsOneWidget); }); - testWidgets('registry list: renders each account name + dir', (tester) async { + testWidgets('registry list: renders each account name + dir, and live-updates on a CLI add', (tester) async { final reg = AccountRegistry(f.services.settings); await tester.runAsync(() => reg.registerAccount('work', '/home/u/.claude-work')); await pumpList(tester); await tester.pump(); expect(find.text('work'), findsOneWidget); expect(find.text('/home/u/.claude-work'), findsOneWidget); + + // A CLI-side registration notifies the shared store → the list rebuilds. + await tester.runAsync(() => reg.registerAccount('personal', '/home/u/.claude-personal')); + await tester.pump(); + expect(find.text('personal'), findsOneWidget); }); testWidgets('registry list: typing a name + Add registers it and publishes login', (tester) async { diff --git a/test/daemon/claude_account_commands_test.dart b/test/daemon/claude_account_commands_test.dart index a23e4248..c2e876d9 100644 --- a/test/daemon/claude_account_commands_test.dart +++ b/test/daemon/claude_account_commands_test.dart @@ -140,6 +140,13 @@ void main() { expect(published.single.data, {'action': 'login', 'name': 'work', 'dir': '/home/u/.claude-work'}); }); + test('remove of an unregistered account → no-such-account error', () async { + wire(); + final r = await run(['remove', 'ghost']); + expect(r.ok, isFalse); + expect(r.error?.message, contains('no such account')); + }); + test('set/unset with no workspace open error clearly', () async { wire(cwd: null); final set = await run(['set', 'work']);