Files
Agent-System/web/src/lib/templatePreviewLabel.test.ts
T
weichenandCursor bdd4b970d4 fix(web): label unfinished template documents as preview
Template bodies were read-only, but the status chip said 编制中 and the lock banner said the document was already controlled.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-21 06:26:05 +00:00

12 lines
736 B
TypeScript

import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
test('template documents are labeled as preview, not 编制中 or 已生效受控', () => {
const bar = readFileSync(new URL('../components/doc/DocGovActionBar.tsx', import.meta.url), 'utf8');
const blocks = readFileSync(new URL('../components/doc/BlockRenderer.tsx', import.meta.url), 'utf8');
assert.equal(bar.includes("ast.lifecycleState === 'template'\n ? '模板预览'"), true);
assert.equal(blocks.includes('任务未完成,正文仍为模板预览。完成编写任务后,编制人才能编辑正文。'), true);
assert.equal(blocks.includes("lifecycleState === 'template'"), true);
});