File size: 875 Bytes
7f0ec95 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import { describe, expect, test, tier } from 'claude-code/testing'
import Views from '../../../hooks/views'
import Fixtures from '../../fixtures'
tier('builtin')
describe('truncate-start', () => {
test('a path padded with combining marks is cut to the room', () => {
const cut = Views.truncateStart(
`src/${Fixtures.COMBINING_ACUTE.repeat(Fixtures.MARKS)}x.ts`,
Fixtures.ROOM,
)
expect([...cut].length).toBeLessThanOrEqual(Fixtures.ROOM)
expect(cut.startsWith('…')).toBe(true)
expect(cut.endsWith('x.ts')).toBe(true)
})
test('a path that fits is whole; one that does not keeps its tail', () => {
expect(Views.truncateStart('src/a.ts', Fixtures.ROOM)).toBe('src/a.ts')
expect(
Views.truncateStart(
'very/long/leading/dirs/file.ts',
Fixtures.NARROW_ROOM,
),
).toBe('…irs/file.ts')
})
})
|