mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-06 07:51:53 +00:00
Make the cwd separator width conditional so the computed status layout matches the rendered row on ultra-narrow terminals.
25 lines
1 KiB
TypeScript
25 lines
1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { statusRuleWidths } from '../components/appChrome.js'
|
|
|
|
describe('statusRuleWidths', () => {
|
|
it('keeps the status rule within the terminal width', () => {
|
|
for (const cols of [8, 12, 20, 40, 100]) {
|
|
const widths = statusRuleWidths(cols, '~/src/hermes-agent/main (some-long-branch-name)')
|
|
|
|
expect(widths.leftWidth + widths.separatorWidth + widths.rightWidth).toBeLessThanOrEqual(cols)
|
|
expect(widths.leftWidth).toBeGreaterThan(0)
|
|
}
|
|
})
|
|
|
|
it('truncates the cwd segment before it can wrap in skinny terminals', () => {
|
|
const widths = statusRuleWidths(24, '~/src/hermes-agent/main (bb/some-extremely-long-branch)')
|
|
|
|
expect(widths.rightWidth).toBeLessThan('~/src/hermes-agent/main (bb/some-extremely-long-branch)'.length)
|
|
expect(widths.leftWidth).toBeGreaterThanOrEqual(8)
|
|
})
|
|
|
|
it('omits the cwd segment when there is no room for it', () => {
|
|
expect(statusRuleWidths(2, 'abcdef')).toEqual({ leftWidth: 2, rightWidth: 0, separatorWidth: 0 })
|
|
})
|
|
})
|