Files
knowledge-governance/web/src/DocumentWorkbench.test.tsx
T
zheromiku dcdc8d1ddd feat: 知识治理平台(含已验证发布/回滚契约)
全栈知识治理平台首次入库(P1-P10 + 发布链路模拟验证闭环):

- 治理核心:源目录/变更集/人工审核/发布批次/发布执行(fail-closed 闸口)
- 测试通道:WeKnora 测试 KB 上传/轮询/验收;poll 完成时写入
  parser_generation/index_generation,修复 manual/seed 路径发布闸口永久拦截
- 发布适配器 v071(本地 source=测试角色 / 云端 target=生产角色 模拟验证通过):
  * ES 导出/导入 mapping 自适应(.keyword 子字段、可选 tenant_id)
  * OSS locator 支持嵌套 scheme;chunks.seq_id 由目标序列分配
  * bundle 归档同身份重试原子替换;verifier 按 bundle chunk_type 计数
  * 回滚 job payload 支持 prior_execution_id(strict 解码)
- 三通道发布+回滚演练实测:publish 4/4 verified,检索命中,
  rollback 4/4 rolled_back,目标端 PG is_enabled=false、ES is_enabled=false
- 前端 A·Data-console 风格全站统一,120 用例通过
- 门禁:go vet / go test 全包通过,gofmt 干净
2026-09-30 10:54:06 +08:00

34 lines
2.2 KiB
TypeScript

import { describe, expect, it, vi } from 'vitest'
import { renderToStaticMarkup } from 'react-dom/server'
import { DocumentWorkbenchView } from './DocumentWorkbench'
import { document } from './documentFixture'
describe('document engineer workbench', () => {
it('shows real file names, source categories and scope without technical identifiers', () => {
const manual={...document,id:'manual',title:'P3 验收文档',source_type:'manual' as const,connection_id:'manual-1'}
const html = renderToStaticMarkup(<DocumentWorkbenchView items={[document,manual]} connections={[]} mode="directory" loading={false} error={null} onRefresh={vi.fn()} onRetry={vi.fn()} retryingId={null} />)
for (const text of ['来源与目录','手册.pdf','使用指南','对外','解析完成','PP分类','未接通目录','文件名','显示 1 份验收文档']) expect(html).toContain(text)
expect(html).not.toContain('P3 验收文档')
expect(html).not.toContain('<code>a</code>')
expect(html).not.toContain('只走这 8 步')
})
it('shows monitoring and no fabricated page progress or production availability', () => {
const html = renderToStaticMarkup(<DocumentWorkbenchView items={[document,{...document,id:'active',processing_state:'processing'}]} connections={[]} mode="monitor" loading={false} error={null} onRefresh={vi.fn()} onRetry={vi.fn()} retryingId={null} />)
expect(html).toContain('解析监控')
expect(html).toContain('来源处理概览')
expect(html).toContain('已就绪 1 / 2')
expect(html).toContain('独立解析')
expect(html).toContain('内容复用')
expect(html).toContain('处理中 1')
expect(html).toContain('解析完成不代表已上线')
expect(html).not.toContain('100%')
expect(html).not.toContain('生产可用')
})
it('does not display zero as a successful load when the request failed', () => {
const html = renderToStaticMarkup(<DocumentWorkbenchView items={[]} connections={[]} mode="directory" loading={false} error="加载失败" onRefresh={vi.fn()} onRetry={vi.fn()} retryingId={null} />)
expect(html).toContain('加载失败')
expect(html).not.toContain('aria-label="当前目录统计"')
expect(html).not.toContain('没有符合条件的文件')
})
})