test(tui): cover same-volume cwd outside home
The existing /opt footer case reaches the ordinary outside-home return on POSIX, but Windows resolves it on the checkout drive while the user profile is on another drive. That exercises the cross-drive guard instead and leaves the same-volume fallback uncovered in Windows coverage. Add the resolved parent of the home directory as a platform-neutral outside-home path. The case now covers the fallback on every host while retaining /opt to exercise the Windows cross-drive path, restoring per-file branch, statement, and line coverage without platform-specific expectations.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { homedir } from 'node:os'
|
import { homedir } from 'node:os'
|
||||||
import { join } from 'node:path'
|
import { join, resolve } from 'node:path'
|
||||||
import { describe, expect, it, vi } from 'vitest'
|
import { describe, expect, it, vi } from 'vitest'
|
||||||
import { Context } from 'cordis'
|
import { Context } from 'cordis'
|
||||||
import type { Terminal } from '@earendil-works/pi-tui'
|
import type { Terminal } from '@earendil-works/pi-tui'
|
||||||
@@ -361,6 +361,11 @@ describe('pi-tui chat lifecycle and transcript', () => {
|
|||||||
expect(unsetResult.terminal.output).toContain('cwd unset')
|
expect(unsetResult.terminal.output).toContain('cwd unset')
|
||||||
await dispose(unsetResult)
|
await dispose(unsetResult)
|
||||||
|
|
||||||
|
const homeParent = resolve(home, '..')
|
||||||
|
const parentResult = await setup({ cwd: homeParent })
|
||||||
|
expect(parentResult.terminal.output).toContain(homeParent)
|
||||||
|
await dispose(parentResult)
|
||||||
|
|
||||||
const outsideResult = await setup({ cwd: '/opt' })
|
const outsideResult = await setup({ cwd: '/opt' })
|
||||||
expect(outsideResult.terminal.output).toContain('/opt')
|
expect(outsideResult.terminal.output).toContain('/opt')
|
||||||
await dispose(outsideResult)
|
await dispose(outsideResult)
|
||||||
|
|||||||
Reference in New Issue
Block a user