mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
feat(chat): render Code Mode execute calls with a dedicated card
This commit is contained in:
1 parent
9075ab1101
commit
f67c3e33b2
6 files changed
+572
-58
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { clampDisplayText } from './clampDisplayText'
|
||||
|
||||
const line = (index: number) => `line ${index} ${'x'.repeat(20)}`
|
||||
|
||||
describe('clampDisplayText', () => {
|
||||
it('returns short text unchanged', () => {
|
||||
const text = 'short output\nwith two lines'
|
||||
|
||||
expect(clampDisplayText(text)).toBe(text)
|
||||
})
|
||||
|
||||
it('shortens text over the display limit while keeping the head and tail', () => {
|
||||
const lines = Array.from({ length: 2000 }, (_, index) => line(index))
|
||||
const text = lines.join('\n')
|
||||
|
||||
const clamped = clampDisplayText(text)
|
||||
|
||||
expect(clamped.length).toBeLessThan(text.length)
|
||||
expect(clamped).toContain('omitted — use the copy button')
|
||||
expect(clamped.startsWith(lines[0])).toBe(true)
|
||||
expect(clamped.endsWith(lines[lines.length - 1])).toBe(true)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user