Align browseDirectory errors with filesystem semantics (Written by Copilot)

This commit is contained in:
Rob Lourens
2026-03-14 12:41:47 -07:00
parent ce5e503640
commit 97ef00da2a
5 changed files with 58 additions and 7 deletions

View File

@@ -6,6 +6,7 @@
import assert from 'assert';
import { DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';
import { observableValue } from '../../../../base/common/observable.js';
import { URI } from '../../../../base/common/uri.js';
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js';
import { NullLogService } from '../../../log/common/log.js';
import { AgentSession, IAgent } from '../../common/agentService.js';
@@ -269,6 +270,25 @@ suite('AgentSideEffects', () => {
});
});
// ---- handleBrowseDirectory ------------------------------------------
suite('handleBrowseDirectory', () => {
test('throws when the directory does not exist', async () => {
await assert.rejects(
() => sideEffects.handleBrowseDirectory(URI.file('/path/that/does/not/exist')),
/Directory not found/,
);
});
test('throws when the target is not a directory', async () => {
await assert.rejects(
() => sideEffects.handleBrowseDirectory(URI.file('/Users/roblou/code/vscode/package.json')),
/Not a directory/,
);
});
});
// ---- agents observable --------------------------------------------------
suite('agents observable', () => {