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) <noreply@anthropic.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user