Apply the AGENTS.md comments guideline to every .ts under tests/: remove what the code already expresses, keep only what it cannot. Removed: spec-header coverage inventories the describe/test tree already names; comments restating the next line's assertion or its message; helper JSDoc whose body already says it; within-file duplicates; five stale claims (trendChart's "six aggregated turns" against agg.length === 8, agentGraph's "six categories" against CATS' seven, fold-timing's "cheapest call LAST" against a loop that feeds it first, fold-surface's unreachable plain-JSON note, contextView's "two turns" for a one-turn fixture). Kept and condensed: the projection-freeze class, strict wire/state-schema hazards, retention and pricing windows, pairing rules, hostile-input rationale, fixture and expectation-array ground truth, jsdom mechanics, and issue-numbered regressions. Comment lines 2604 -> 2014 (-22%); 85 module headers kept, 30 coverage inventories dropped; every surviving comment line is within the 140-column limit, with 36 wrapped lines joined onto fuller ones. No logic, string, identifier, import or directive changed: a comment-strip gate proves each file's comment-free code is byte-identical to HEAD, and a line-level proof pairs all 845 changed lines with an unchanged code part. pnpm run lint && pnpm run test (106 files / 2061 tests, per-file 100% coverage) && pnpm run build all pass.
40 lines
2.1 KiB
TypeScript
40 lines
2.1 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
import { describe, test } from 'vitest'
|
|
import { makeNodeText } from '../../../src/client/components/nodes'
|
|
import { makeKit } from '../helpers/kit'
|
|
|
|
const kit = makeKit()
|
|
const nodeText = makeNodeText(kit)
|
|
|
|
describe('makeNodeText', () => {
|
|
test('tool results name the tool; failures carry the warning glyph', () => {
|
|
assert.equal(nodeText({ seq: 1, cat: 'tool', tokens: 1, tool: 'bash' }), 'Tool Result ← bash')
|
|
assert.equal(nodeText({ seq: 1, cat: 'tool', tokens: 1 }), 'Tool Result')
|
|
assert.equal(nodeText({ seq: 1, cat: 'tool', tokens: 1, tool: 'bash', err: true }), 'Tool Result ← bash ⚠')
|
|
})
|
|
|
|
test('skill-tagged nodes lead with the skill name', () => {
|
|
// The skill branch follows the tool branch: skill results keep their
|
|
// tool-result label; the skill name leads on injected nodes.
|
|
assert.equal(nodeText({ seq: 1, cat: 'tool', tokens: 1, skill: 'code-review' }), 'Tool Result')
|
|
assert.equal(nodeText({ seq: 1, cat: 'inject', tokens: 1, skill: 'code-review' }), 'Skill: code-review')
|
|
})
|
|
|
|
test('assistant replies show text, a calls breadcrumb, or the empty marker', () => {
|
|
assert.equal(nodeText({ seq: 1, cat: 'assistant', tokens: 1, text: 'hi' }), 'hi')
|
|
assert.equal(nodeText({ seq: 1, cat: 'assistant', tokens: 1, calls: ['bash', 'read'] }), 'Calls bash, read')
|
|
assert.equal(nodeText({ seq: 1, cat: 'assistant', tokens: 1 }), '(empty reply)')
|
|
})
|
|
|
|
test('snapshot-form text gets the snapshot prefix; plain text shows as-is', () => {
|
|
assert.equal(nodeText({ seq: 1, cat: 'inject', tokens: 1, form: 'snapshot', text: 'a, b' }), 'Snapshot: a, b')
|
|
assert.equal(nodeText({ seq: 1, cat: 'user', tokens: 1, text: 'plain' }), 'plain')
|
|
})
|
|
|
|
test('textless injects label their form; anything else is a non-text message', () => {
|
|
assert.equal(nodeText({ seq: 1, cat: 'inject', tokens: 1, form: 'notice' }), 'Notice')
|
|
assert.equal(nodeText({ seq: 1, cat: 'inject', tokens: 1 }), 'Context Injection')
|
|
assert.equal(nodeText({ seq: 1, cat: 'user', tokens: 1 }), '(non-text message)')
|
|
})
|
|
})
|