63 lines
3.1 KiB
TypeScript
63 lines
3.1 KiB
TypeScript
import { fireEvent, render, screen } from '@testing-library/react'
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
import TeamFoundationApp from './TeamFoundationApp'
|
|
|
|
describe('TeamFoundationApp', () => {
|
|
it('presents the lighthouse as an AI operating-system shell', () => {
|
|
render(<TeamFoundationApp onOpenKnowledgeSpace={vi.fn()} />)
|
|
|
|
expect(screen.getByRole('heading', { name: '光湖灯塔' })).toBeInTheDocument()
|
|
expect(screen.getByText('AI 应用操作系统')).toBeInTheDocument()
|
|
expect(screen.getByText('0.2.0 内测版')).toBeInTheDocument()
|
|
expect(screen.getByRole('region', { name: '热插拔模块' })).toBeInTheDocument()
|
|
expect(screen.getByText('模块运行框架')).toBeInTheDocument()
|
|
})
|
|
|
|
it('exposes the four team domains as workspaces', () => {
|
|
render(<TeamFoundationApp onOpenKnowledgeSpace={vi.fn()} />)
|
|
|
|
for (const domain of ['光湖主域', '光湖分域', '光湖零域', '光湖零感域']) {
|
|
expect(screen.getByRole('button', { name: new RegExp(domain) })).toBeInTheDocument()
|
|
}
|
|
|
|
fireEvent.click(screen.getByRole('button', { name: /光湖零域/ }))
|
|
expect(screen.getByRole('heading', { name: '光湖零域' })).toBeInTheDocument()
|
|
expect(screen.getByText(/系统服务、权限与模块登记/)).toBeInTheDocument()
|
|
})
|
|
|
|
it('keeps the Fifth Domain as a locked authorization-only entrance', () => {
|
|
render(<TeamFoundationApp onOpenKnowledgeSpace={vi.fn()} />)
|
|
|
|
expect(screen.getByRole('heading', { name: '第五域受控入口' })).toBeInTheDocument()
|
|
expect(screen.getByRole('button', { name: '等待授权接入' })).toBeDisabled()
|
|
expect(screen.getByText(/仅保留入口。完成服务器、编号与邮件授权/)).toBeInTheDocument()
|
|
})
|
|
|
|
it('does not expose private systems in the public team shell', () => {
|
|
render(<TeamFoundationApp onOpenKnowledgeSpace={vi.fn()} />)
|
|
|
|
expect(screen.queryByText('心跳核心频道')).not.toBeInTheDocument()
|
|
expect(screen.queryByText('永恒湖心系统')).not.toBeInTheDocument()
|
|
expect(screen.queryByText('零点原核频道')).not.toBeInTheDocument()
|
|
expect(screen.queryByText('短剧视频 AI')).not.toBeInTheDocument()
|
|
expect(screen.queryByText('服务器与灯塔节点')).not.toBeInTheDocument()
|
|
})
|
|
|
|
it('opens the real local knowledge workspace from the zero-sense domain', () => {
|
|
const onOpenKnowledgeSpace = vi.fn()
|
|
render(<TeamFoundationApp onOpenKnowledgeSpace={onOpenKnowledgeSpace} />)
|
|
|
|
fireEvent.click(screen.getByRole('button', { name: /光湖零感域/ }))
|
|
fireEvent.click(screen.getByRole('button', { name: '从光湖零感域进入 AI 知识空间' }))
|
|
|
|
expect(onOpenKnowledgeSpace).toHaveBeenCalledTimes(1)
|
|
})
|
|
|
|
it('labels unfinished modules instead of exposing inert controls', () => {
|
|
render(<TeamFoundationApp onOpenKnowledgeSpace={vi.fn()} />)
|
|
|
|
expect(screen.getByRole('button', { name: 'AI 创作空间 尚未接入' })).toBeDisabled()
|
|
expect(screen.queryByRole('button', { name: '搜索模块' })).not.toBeInTheDocument()
|
|
expect(screen.queryByRole('button', { name: '系统设置' })).not.toBeInTheDocument()
|
|
})
|
|
})
|