mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-14 04:02:26 +00:00
fix(tui): reserve control on macOS
This commit is contained in:
parent
88396698ea
commit
1d0b94a1b9
6 changed files with 63 additions and 66 deletions
|
|
@ -3,27 +3,23 @@ import { describe, expect, it, vi } from 'vitest'
|
|||
import { readClipboardText } from '../lib/clipboard.js'
|
||||
|
||||
describe('readClipboardText', () => {
|
||||
it('does nothing off macOS', () => {
|
||||
it('does nothing off macOS', async () => {
|
||||
const run = vi.fn()
|
||||
|
||||
expect(readClipboardText('linux', run)).toBeNull()
|
||||
await expect(readClipboardText('linux', run)).resolves.toBeNull()
|
||||
expect(run).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('reads text from pbpaste on macOS', () => {
|
||||
const run = vi.fn().mockReturnValue({ status: 0, stdout: 'hello world\n' })
|
||||
it('reads text from pbpaste on macOS', async () => {
|
||||
const run = vi.fn().mockResolvedValue({ stdout: 'hello world\n' })
|
||||
|
||||
expect(readClipboardText('darwin', run)).toBe('hello world\n')
|
||||
expect(run).toHaveBeenCalledWith(
|
||||
'pbpaste',
|
||||
[],
|
||||
expect.objectContaining({ encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] })
|
||||
)
|
||||
await expect(readClipboardText('darwin', run)).resolves.toBe('hello world\n')
|
||||
expect(run).toHaveBeenCalledWith('pbpaste', [], expect.objectContaining({ encoding: 'utf8', windowsHide: true }))
|
||||
})
|
||||
|
||||
it('returns null when pbpaste fails', () => {
|
||||
const run = vi.fn().mockReturnValue({ status: 1, stdout: '' })
|
||||
it('returns null when pbpaste fails', async () => {
|
||||
const run = vi.fn().mockRejectedValue(new Error('pbpaste failed'))
|
||||
|
||||
expect(readClipboardText('darwin', run)).toBeNull()
|
||||
await expect(readClipboardText('darwin', run)).resolves.toBeNull()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue