Files
orca/src/shared/command-environment.test.ts
T
OrcaWinandOrcaWin c7ff101424 Remove 40 low-value test suites and redundant cases (#40126)
* Remove low-value ACP, hook and renderer test suites

* Remove low-value shared automation and agent test cases

* Remove low-value packaging and mobile probe test cases

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
2026-11-08 20:33:33 -08:00

28 lines
953 B
TypeScript

import { describe, expect, it } from 'vitest'
import { extractLeadingEnvAssignments, mergeCommandEnvironment } from './command-environment'
describe('command environment assignments', () => {
it('lets the last assignment override every Windows spelling without mutating the base', () => {
const base = { PATH: 'old', Path: 'also old', TOKEN: 'old', KEEP: 'keep', ComSpec: 'cmd.exe' }
const { env } = extractLeadingEnvAssignments([
'Path=first',
'PATH=second',
'Path=last',
'token=',
'agent'
])
expect(mergeCommandEnvironment(base, env, 'win32')).toEqual({
PATH: 'last',
TOKEN: '',
KEEP: 'keep',
COMSPEC: 'cmd.exe'
})
expect(base.PATH).toBe('old')
expect(mergeCommandEnvironment({ PATH: 'old' }, { Path: 'new' }, 'linux')).toEqual({
PATH: 'old',
Path: 'new'
})
expect(mergeCommandEnvironment(undefined, undefined, 'darwin')).toBeUndefined()
})
})