mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-05 12:42:30 +00:00
Bring apps/desktop and ui-tui to a clean state for typecheck, eslint,
and prettier:
- Run prettier across both trees (printWidth/wrap drift; prettier is not
CI-enforced for these JS projects, so main had accumulated drift).
- Apply eslint --fix for padding-line-between-statements and perfectionist
import/export sorting.
- Manual fixes for non-auto-fixable rules:
- remove unused node:net import in electron/main.cjs (uses Electron net)
- replace inline `typeof import(...)` annotations with top-level
`import type * as EnvModule` in two ui-tui test files
- scoped eslint-disable no-control-regex on intentional sentinel/ANSI
regexes (mathUnicode.ts, text.ts)
- resolve react-hooks/exhaustive-deps per-case: correct swapped/missing
deps, collapse redundant session.* members, and justified disables on
settings mount-only data-load effects to preserve run-once behavior
No behavior changes; test pass/fail counts are unchanged from the main
baseline.
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { applyPrintableInsert, shouldRouteMultiCharInputAsPaste } from '../components/textInput.js'
|
|
|
|
describe('applyPrintableInsert', () => {
|
|
it('applies non-bracketed multi-character bursts immediately', () => {
|
|
const burst = applyPrintableInsert('abc', 3, 'xxxxx')
|
|
|
|
const repeated = [...'xxxxx'].reduce((state, ch) => applyPrintableInsert(state.value, state.cursor, ch)!, {
|
|
cursor: 3,
|
|
value: 'abc'
|
|
})
|
|
|
|
expect(burst).toEqual({ cursor: 8, value: 'abcxxxxx' })
|
|
expect(burst).toEqual(repeated)
|
|
})
|
|
|
|
it('replaces the selected range for burst input', () => {
|
|
expect(applyPrintableInsert('abZZef', 4, 'cd', { end: 4, start: 2 })).toEqual({
|
|
cursor: 4,
|
|
value: 'abcdef'
|
|
})
|
|
})
|
|
|
|
it('rejects control or escape-bearing input', () => {
|
|
expect(applyPrintableInsert('abc', 3, '\x1b[200~pasted')).toBeNull()
|
|
expect(applyPrintableInsert('abc', 3, '\t')).toBeNull()
|
|
})
|
|
})
|
|
|
|
describe('shouldRouteMultiCharInputAsPaste', () => {
|
|
it('keeps newline-bearing chunks on the paste path', () => {
|
|
expect(shouldRouteMultiCharInputAsPaste('hello\nworld')).toBe(true)
|
|
expect(shouldRouteMultiCharInputAsPaste('hello\r\nworld'.replace(/\r\n/g, '\n'))).toBe(true)
|
|
})
|
|
|
|
it('treats repeated printable key bursts as immediate input', () => {
|
|
expect(shouldRouteMultiCharInputAsPaste('xxxxx')).toBe(false)
|
|
})
|
|
})
|