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()
for (const text of ['来源与目录','手册.pdf','使用指南','对外','解析完成','PP分类','未接通目录','文件名','显示 1 份验收文档']) expect(html).toContain(text)
expect(html).not.toContain('P3 验收文档')
expect(html).not.toContain('a')
expect(html).not.toContain('只走这 8 步')
})
it('shows monitoring and no fabricated page progress or production availability', () => {
const html = renderToStaticMarkup()
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()
expect(html).toContain('加载失败')
expect(html).not.toContain('aria-label="当前目录统计"')
expect(html).not.toContain('没有符合条件的文件')
})
})