Harden computer use runtime and CLI (#4705)
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { quoteCliCommandArgument } from './shell-command-quote'
|
||||
|
||||
describe('quoteCliCommandArgument', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
it('leaves simple selectors unquoted', () => {
|
||||
expect(quoteCliCommandArgument('com.apple.finder')).toBe('com.apple.finder')
|
||||
})
|
||||
|
||||
it('quotes values with spaces for the current platform shell', () => {
|
||||
vi.spyOn(process, 'platform', 'get').mockReturnValue('darwin')
|
||||
expect(quoteCliCommandArgument('Text Editor')).toBe("'Text Editor'")
|
||||
|
||||
vi.spyOn(process, 'platform', 'get').mockReturnValue('win32')
|
||||
expect(quoteCliCommandArgument('Text Editor')).toBe('"Text Editor"')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user