Files
bowenliang123 87a2893190 refactor(comments): clean up the test-suite comments to the guideline
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.
2026-10-10 00:50:55 +08:00

45 lines
1.7 KiB
TypeScript

import { createElement as h } from 'react'
import assert from 'node:assert/strict'
import { describe, test } from 'vitest'
import { makeDetailNote } from '../../../src/client/components/detailNote'
import { DICT_EN, DICT_ZH } from '../../../src/client/i18n'
import { click, makeKit, mount, query, text } from '../helpers/kit'
const DetailNote = makeDetailNote(makeKit())
const DetailNoteZh = makeDetailNote(makeKit('zh'))
describe('DetailNote', () => {
test('the loading strip names the pending read', async () => {
const m = await mount(h(DetailNote, { state: 'loading' as const }))
assert.equal(text(m.container), DICT_EN['detail.loading'])
assert.equal(query(m.container, 'div').className, 'lc-empty', 'the default well class')
await m.unmount()
})
test('the failed strip arms the retry button; the caller class applies', async () => {
let retries = 0
const m = await mount(h(DetailNote, {
state: 'failed' as const,
onRetry: () => { retries++ },
className: 'lc-br-note',
}))
assert.equal(query(m.container, 'div').className, 'lc-br-note')
await click(query(m.container, '.lc-br-retry'))
assert.equal(retries, 1)
await m.unmount()
})
test('a failed note without a retry callback renders the inert text', async () => {
const m = await mount(h(DetailNote, { state: 'failed' as const }))
assert.equal(text(m.container), DICT_EN['detail.loadFailed'])
assert.equal(m.container.querySelector('button'), null)
await m.unmount()
})
test('the zh locale localizes both states', async () => {
const m = await mount(h(DetailNoteZh, { state: 'loading' as const }))
assert.equal(text(m.container), DICT_ZH['detail.loading'])
await m.unmount()
})
})