mirror of
https://github.com/stablyai/orca.git
synced 2026-10-13 16:02:49 +00:00
* test: reproduce OpenCode plugin installation in the wrong config root * fix: install OpenCode hooks in the execution config directory * test: isolate config installation from CLI version probing * style: format consumer config installation controls * fix: use checked startup environment and supported relay shell context * fix: install OpenCode hooks using the selected execution shell * test(opencode): assert consumer config root in PTY fixtures --------- Co-authored-by: Codex <codex@openai.com> Co-authored-by: Orca <orca@stably.ai>
46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
import { afterEach, describe, expect, it } from 'vitest'
|
|
import { join } from 'node:path'
|
|
import { resolveOpenCodeConfigDirectory } from './opencode-config-directory'
|
|
|
|
const originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform')
|
|
afterEach(() => {
|
|
if (originalPlatform) {
|
|
Object.defineProperty(process, 'platform', originalPlatform)
|
|
}
|
|
})
|
|
|
|
describe('OpenCode consumer config directory', () => {
|
|
it('uses the execution HOME instead of the installer home on POSIX', () => {
|
|
Object.defineProperty(process, 'platform', { value: 'linux' })
|
|
expect(resolveOpenCodeConfigDirectory({ HOME: '/consumer' }, '/installer')).toBe(
|
|
join('/consumer', '.config', 'opencode')
|
|
)
|
|
})
|
|
|
|
it('uses the execution USERPROFILE on Windows', () => {
|
|
Object.defineProperty(process, 'platform', { value: 'win32' })
|
|
expect(
|
|
resolveOpenCodeConfigDirectory({ USERPROFILE: '/consumer', HOME: '/shell' }, '/installer')
|
|
).toBe(join('/consumer', '.config', 'opencode'))
|
|
})
|
|
|
|
it('keeps the host home fallback when the execution home is absent', () => {
|
|
expect(resolveOpenCodeConfigDirectory({}, '/installer')).toBe(
|
|
join('/installer', '.config', 'opencode')
|
|
)
|
|
})
|
|
|
|
it('does not treat a Windows shell HOME as the native OpenCode home', () => {
|
|
Object.defineProperty(process, 'platform', { value: 'win32' })
|
|
expect(resolveOpenCodeConfigDirectory({ HOME: '/shell' }, '/installer')).toBe(
|
|
join('/installer', '.config', 'opencode')
|
|
)
|
|
})
|
|
|
|
it('keeps XDG_CONFIG_HOME ahead of the execution home', () => {
|
|
expect(
|
|
resolveOpenCodeConfigDirectory({ HOME: '/consumer', XDG_CONFIG_HOME: '/xdg' }, '/installer')
|
|
).toBe(join('/xdg', 'opencode'))
|
|
})
|
|
})
|