codeburn/tests/context-tui-title.test.ts
reviewer f72b8ad11a dashboard: Workflow panel, footer coaching notes, title-first context list
Phase-1 TUI additions, all reusing the parsed projects the dashboard already
holds (no re-parse):

- Workflow panel: a compact box in the grid beside Claude Agent Types showing
  Corrections (N% with count), First edit (median), Rework (top file basename
  x sessions) and Coverage (share of cost-bearing calls priced). Coverage is
  dropped when there is nothing to price so it never shows a hollow 100%. The
  panel hides when there is no signal at all (no user turns and no churn) and
  follows the existing half-width/stack responsive behaviour.
- Footer coaching note: rotates one buildCoachingNotes line through the footer
  above the status bar, only when notes exist.
- Context browser: the AI title is now the primary label with the short id
  demoted into the dim metadata cluster, columns kept aligned.

Pure formatting/selection helpers are covered by tests.
2026-07-20 22:26:50 +02:00

22 lines
771 B
TypeScript

import { describe, it, expect } from 'vitest'
import { sessionPrimaryLabel } from '../src/context-tui.js'
describe('sessionPrimaryLabel', () => {
it('uses the title when present', () => {
expect(sessionPrimaryLabel('Refactor the parser')).toBe('Refactor the parser')
})
it('trims surrounding whitespace', () => {
expect(sessionPrimaryLabel(' Fix the dashboard ')).toBe('Fix the dashboard')
})
it('falls back to a placeholder for an empty or whitespace-only title', () => {
expect(sessionPrimaryLabel('')).toBe('untitled session')
expect(sessionPrimaryLabel(' ')).toBe('untitled session')
})
it('falls back to a placeholder for an undefined title', () => {
expect(sessionPrimaryLabel(undefined)).toBe('untitled session')
})
})