Files
orca/src/shared/string-chunk-compaction.test.ts
T
NeilandOrca c419aadb19 oom(01): A1-shared-readers — reintroduce #10179 subset (#10294)
Files: 18 applied, 0 deleted (from 6eb70d8370)

Co-authored-by: Orca <help@stably.ai>
2026-07-24 20:30:31 -07:00

18 lines
682 B
TypeScript

import { describe, expect, it } from 'vitest'
import { appendCompactedStringChunk, RETAINED_STRING_CHUNK_LIMIT } from './string-chunk-compaction'
describe('appendCompactedStringChunk', () => {
it('preserves 100,000 fragments within the retained chunk limit', () => {
const chunks: string[] = []
let maxRetainedChunks = 0
for (let index = 0; index < 100_000; index += 1) {
appendCompactedStringChunk(chunks, String.fromCharCode(97 + (index % 26)))
maxRetainedChunks = Math.max(maxRetainedChunks, chunks.length)
}
expect(maxRetainedChunks).toBeLessThanOrEqual(RETAINED_STRING_CHUNK_LIMIT)
expect(chunks.join('')).toHaveLength(100_000)
})
})