Files
orca/src/shared/orchestration-task-summary.test.ts
T

20 lines
792 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from 'vitest'
import { abbreviateOrchestrationTasks } from './orchestration-task-summary'
describe('abbreviateOrchestrationTasks', () => {
it('does not report whitespace normalization as truncation', () => {
const [task] = abbreviateOrchestrationTasks([{ spec: 'Short\n\n task' }])
expect(task).toEqual({ spec: 'Short task', spec_truncated: false })
})
it('does not split a surrogate pair at the truncation boundary', () => {
// UTF-16 boundary 159 splits the emoji’s surrogate pair.
const [task] = abbreviateOrchestrationTasks([{ spec: `${'a'.repeat(158)}😀${'b'.repeat(40)}` }])
expect(task.spec_truncated).toBe(true)
expect(task.spec.isWellFormed()).toBe(true)
expect(task.spec.endsWith('…')).toBe(true)
})
})