Files
orca/src/shared/dsb-headless-command.test.ts
T
NeilandWooseong Kim af13da5db7 Recognize Build terminals and preserve Windows confirmation key routing
Recognize dsb terminal identity and preserve foreground Windows confirmation key routing.

Co-authored-by: Wooseong Kim <innocarpe@gmail.com>
2026-10-03 20:23:33 -07:00

60 lines
2.3 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { isDsbHeadlessOneShotCommand } from './dsb-headless-command'
describe('DeepSeek Build headless one-shot commands', () => {
it.each([
['-r', './preload.js'],
['--require', './preload.js'],
['--import', './preload.mjs'],
['--loader', './loader.mjs'],
['--experimental-loader', './loader.mjs'],
['--require=./preload.js'],
['--import=./preload.mjs']
])('finds run after Node options %j', (...options) => {
const shim = '/usr/lib/node_modules/@innocarpe/deepseek-build/npm/bin/dsb.js'
expect(isDsbHeadlessOneShotCommand(['node', ...options, shim, 'run', 'task'])).toBe(true)
expect(isDsbHeadlessOneShotCommand(['node', ...options, shim, 'agent'])).toBe(false)
})
it.each(['/usr/local/bin/node', 'C:\\Program Files\\nodejs\\node.exe'])(
'recognizes the interpreter path %s before preload arguments',
(node) => {
const shim = 'C:\\Users\\dev\\node_modules\\@innocarpe\\deepseek-build\\npm\\bin\\dsb.js'
expect(isDsbHeadlessOneShotCommand([node, '-r', './preload.js', shim, 'run', 'task'])).toBe(
true
)
}
)
it.each(['--cwd', '--preset', '--base-url', '--session', '--worktree-ref', '--effort'])(
'finds run after the upstream value option %s',
(option) => {
expect(isDsbHeadlessOneShotCommand(['dsb', option, 'value', 'run', 'task'])).toBe(true)
expect(isDsbHeadlessOneShotCommand(['dsb', `${option}=value`, 'run', 'task'])).toBe(true)
expect(isDsbHeadlessOneShotCommand(['dsb', option, 'run', 'agent'])).toBe(false)
}
)
it('treats run as a one-shot and leaves the TUI interactive', () => {
expect(isDsbHeadlessOneShotCommand(['dsb', 'run', 'explain this'])).toBe(true)
expect(isDsbHeadlessOneShotCommand(['dsb', '--dogfood'])).toBe(false)
expect(isDsbHeadlessOneShotCommand(['dsb', 'agent'])).toBe(false)
expect(isDsbHeadlessOneShotCommand(['dsb', '--resume', 'sess-1'])).toBe(false)
expect(
isDsbHeadlessOneShotCommand([
'node',
'/usr/lib/node_modules/@innocarpe/deepseek-build/npm/bin/dsb.js',
'run',
'explain this'
])
).toBe(true)
expect(
isDsbHeadlessOneShotCommand([
'node',
'/usr/lib/node_modules/@innocarpe/deepseek-build/npm/bin/dsb.js',
'--dogfood'
])
).toBe(false)
})
})