mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
test: update reflow tail and generated mobile payload expectations
This commit is contained in:
@@ -6,8 +6,8 @@ import { XTERM_HTML } from './terminal-webview-html'
|
||||
// uncovered region ships silently. A diff here means the emitted WebView source changed —
|
||||
// update these values only when that change is deliberate, and only after checking the
|
||||
// document still runs. Refactors that merely move slice boundaries must leave them alone.
|
||||
const EXPECTED_SHA256 = '942889f8127b6f61e43eaa1c1273d67fcc62c5f58c7a66a7209348815d050d3d'
|
||||
const EXPECTED_LENGTH = 732644
|
||||
const EXPECTED_SHA256 = 'a10f26ac720c96c14472574b955b30e816667b0a15dfe4e0b0ce11641691506b'
|
||||
const EXPECTED_LENGTH = 732650
|
||||
|
||||
describe('terminal WebView payload', () => {
|
||||
it('composes the expected document', () => {
|
||||
|
||||
@@ -32,7 +32,7 @@ import { safeFind } from './terminal-search-safe-find'
|
||||
* anything that is not the decoration error.
|
||||
*/
|
||||
|
||||
/** Reaches the ring behind the public buffer API to pin the negative-index state reflow leaves. */
|
||||
/** Checks retained rows outside the public buffer bounds. */
|
||||
type RingBufferProbe = {
|
||||
_core: { buffer: { lines: { _array: unknown[] } } }
|
||||
}
|
||||
@@ -282,15 +282,22 @@ describe('terminal search inside one very long wrapped line', () => {
|
||||
for (let i = 0; i < 20; i++) {
|
||||
await write(terminal, `line ${i}\r\n`)
|
||||
}
|
||||
// Narrowing a pane reflows the buffer, which leaves the ring holding entries at negative
|
||||
// indices, so `getLine(-1)` answers with a stale wrapped line instead of undefined. The rewind
|
||||
// has to stop at row 0 or it walks backwards forever and hangs the renderer.
|
||||
// Reflow must retain the searchable tail without keeping evicted rows at negative indices.
|
||||
terminal.resize(15, 5)
|
||||
await write(terminal, '')
|
||||
expect(terminal.buffer.active.getLine(0)?.isWrapped).toBe(true)
|
||||
expect(
|
||||
Object.keys((terminal as unknown as RingBufferProbe)._core.buffer.lines._array)
|
||||
).toContain('-1')
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: This real pinned xterm instance uses the CircularList backing array asserted below.
|
||||
Object.keys((terminal as unknown as RingBufferProbe)._core.buffer.lines._array).filter(
|
||||
(key) => Number(key) < 0
|
||||
)
|
||||
).toEqual([])
|
||||
const retainedLines = Array.from({ length: terminal.buffer.active.length }, (_, index) =>
|
||||
terminal.buffer.active.getLine(index)?.translateToString(true)
|
||||
)
|
||||
expect(retainedLines.filter((line) => line?.startsWith('line '))).toEqual(
|
||||
Array.from({ length: 20 }, (_, index) => `line ${index}`)
|
||||
)
|
||||
|
||||
const startedAt = performance.now()
|
||||
const found = safeFind((term, options) => search.findNext(term, options), NEEDLE, {
|
||||
|
||||
Reference in New Issue
Block a user