fix(llm-pi-ai): stub both home spellings in the tilde-expansion test

os.homedir() reads HOME on POSIX and USERPROFILE on Windows; stubbing
only HOME left the Windows lane expanding ~ into the real profile
directory and failing the fileExists assertions.
This commit is contained in:
Yichen Jiang committed 2026-08-20 17:58:38 +08:00
1 parent 6428b844ef
commit 0b2bc3d651
1 file changed
+3
@@ -158,7 +158,10 @@ describe('pi-ai ambient auth context', () => {
const dir = await mkdtemp(join(tmpdir(), 'dsh-pi-home-'))
dirs.push(dir)
await writeFile(join(dir, 'creds'), 'x')
// Both spellings of "home": os.homedir() reads HOME on POSIX and
// USERPROFILE on Windows, and the expansion under test goes through it.
vi.stubEnv('HOME', dir)
vi.stubEnv('USERPROFILE', dir)
const context = authContextFrom(await stored())
await expect(context.fileExists('~/creds')).resolves.toBe(true)