From e639f135b5ea0885c12019326ba91546d405b4f4 Mon Sep 17 00:00:00 2001 From: Zeheng Huang <153708448+hunjaiboy@users.noreply.github.com> Date: Mon, 1 Jun 2026 21:58:33 -0700 Subject: [PATCH] test(filesystem): cover encoded Windows root URIs --- src/filesystem/__tests__/roots-utils.test.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/filesystem/__tests__/roots-utils.test.ts b/src/filesystem/__tests__/roots-utils.test.ts index 1a39483953..1e6568892c 100644 --- a/src/filesystem/__tests__/roots-utils.test.ts +++ b/src/filesystem/__tests__/roots-utils.test.ts @@ -58,6 +58,23 @@ describe('getValidRootDirectories', () => { expect(result).toHaveLength(1); expect(result[0]).toBe(subDir); }); + + it('should process VS Code Windows file URIs with encoded drive colons', async () => { + if (process.platform !== 'win32') { + return; + } + + const windowsPath = testDir1.replace(/\\/g, '/'); + const encodedDrivePath = windowsPath.replace(/^([a-zA-Z]):/, (_, drive: string) => `${drive.toLowerCase()}%3A`); + const roots: Root[] = [ + { uri: `file:///${encodedDrivePath}`, name: 'VS Code workspace root' } + ]; + + const result = await getValidRootDirectories(roots); + + expect(result).toContain(testDir1); + expect(result).toHaveLength(1); + }); }); describe('error handling', () => { @@ -81,4 +98,4 @@ describe('getValidRootDirectories', () => { expect(result).toHaveLength(1); }); }); -}); \ No newline at end of file +});