feat: release OpsXShell 2.1.0 native Tauri edition
This commit is contained in:
1 parent
e9a0d21758
commit
a3dba0c6ed
311 files changed
+31748
-14897
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { extractBashBlocks, singleLineTerminalInsert, terminalContextLineCount } from '../../src/utils/aiResponse'
|
||||
|
||||
describe('terminal AI response guards', () => {
|
||||
it('extracts shell code without treating prose as a command', () => {
|
||||
expect(extractBashBlocks('检查:\n```bash\nuname -a\n```')).toEqual(['uname -a'])
|
||||
expect(extractBashBlocks('请运行 uname -a')).toEqual([])
|
||||
})
|
||||
|
||||
it('only permits a single line and never adds enter', () => {
|
||||
expect(singleLineTerminalInsert('date\n')).toBe('date')
|
||||
expect(singleLineTerminalInsert('date\nuname -a')).toBeNull()
|
||||
expect(singleLineTerminalInsert('')).toBeNull()
|
||||
})
|
||||
|
||||
it('counts exactly the context lines shown to the user', () => {
|
||||
expect(terminalContextLineCount('a\nb\n')).toBe(2)
|
||||
expect(terminalContextLineCount('')).toBe(0)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user