mirror of
https://github.com/stablyai/orca.git
synced 2026-11-02 10:08:13 +00:00
The renderer imports quick-open-listing-limits for the result cap, but the same module also held a Buffer-backed accumulator that imports the CommonJS @orca/process-host dist. Vite dev serves that dist as raw ESM, so the named import failed and the workspace workbench and right sidebar crashed. Move the accumulator to its own main-only module.
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
import { QuickOpenSubprocessPathAccumulator } from './quick-open-subprocess-path-accumulator'
|
|
|
|
describe('Quick Open subprocess path accumulator', () => {
|
|
it('bounds one fragmented subprocess path and recovers after overflow', () => {
|
|
const onPath = vi.fn(() => true)
|
|
const fields = new QuickOpenSubprocessPathAccumulator(0, 3)
|
|
|
|
expect(fields.push(Buffer.from('ab'), onPath)).toBe('continue')
|
|
expect(fields.push(Buffer.from('cd'), onPath)).toBe('path-too-large')
|
|
expect(fields.push(Buffer.from('ok\0'), onPath)).toBe('continue')
|
|
expect(onPath).toHaveBeenCalledTimes(1)
|
|
expect(onPath).toHaveBeenCalledWith('ok')
|
|
})
|
|
|
|
it('stops within a multi-path chunk without visiting later fields', () => {
|
|
const visited: string[] = []
|
|
const fields = new QuickOpenSubprocessPathAccumulator(0, 16)
|
|
|
|
expect(
|
|
fields.push(Buffer.from('one\0two\0three\0'), (path) => {
|
|
visited.push(path)
|
|
return path !== 'two'
|
|
})
|
|
).toBe('stopped')
|
|
expect(visited).toEqual(['one', 'two'])
|
|
})
|
|
})
|