mirror of
https://github.com/stablyai/orca.git
synced 2026-09-27 00:02:37 +00:00
Files: 18 applied, 0 deleted (from 6eb70d8370)
Co-authored-by: Orca <help@stably.ai>
18 lines
682 B
TypeScript
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)
|
|
})
|
|
})
|