chore: 保存工作副本——客户端授权新契约(双端点/验签/令牌/周检)与桌面会话可靠性改进

This commit is contained in:
Logan.Li committed 2026-09-14 22:10:22 +08:00
1 parent f71eef0eba
commit ae6093c9b3
163 files changed
+4911 -2494

No files matched your search

+7 -9
View File
@@ -20,9 +20,7 @@ describe('patrol / desktop (rdp + vnc)', () => {
it('RDP connect dialog submits host/port/username/password', async () => {
const user = userEvent.setup()
const onConnect = vi.fn()
render(
<DesktopConnectDialog protocol="rdp" isOpen onClose={vi.fn()} onConnect={onConnect} />
)
render(<DesktopConnectDialog protocol="rdp" isOpen onClose={vi.fn()} onConnect={onConnect} />)
expect(screen.getByText('连接 RDP')).toBeVisible()
expect(screen.getByLabelText('端口')).toHaveValue(3389)
@@ -48,9 +46,7 @@ describe('patrol / desktop (rdp + vnc)', () => {
it('VNC connect dialog defaults to port 5900 and allows password-only auth', async () => {
const user = userEvent.setup()
const onConnect = vi.fn()
render(
<DesktopConnectDialog protocol="vnc" isOpen onClose={vi.fn()} onConnect={onConnect} />
)
render(<DesktopConnectDialog protocol="vnc" isOpen onClose={vi.fn()} onConnect={onConnect} />)
expect(screen.getByText('连接 VNC')).toBeVisible()
expect(screen.getByLabelText('端口')).toHaveValue(5900)
@@ -73,9 +69,7 @@ describe('patrol / desktop (rdp + vnc)', () => {
it('requires host before connecting', async () => {
const user = userEvent.setup()
const onConnect = vi.fn()
render(
<DesktopConnectDialog protocol="rdp" isOpen onClose={vi.fn()} onConnect={onConnect} />
)
render(<DesktopConnectDialog protocol="rdp" isOpen onClose={vi.fn()} onConnect={onConnect} />)
await user.click(screen.getByRole('button', { name: '连接' }))
expect(await screen.findByText(/请输入主机/)).toBeVisible()
expect(onConnect).not.toHaveBeenCalled()
@@ -103,6 +97,10 @@ describe('patrol / desktop (rdp + vnc)', () => {
await waitFor(() => {
expect(screen.getByLabelText('端口')).toHaveValue(3389)
})
expect(screen.getAllByLabelText('密码')).toHaveLength(1)
await user.click(screen.getByText('高级选项'))
expect(screen.queryByLabelText('跳板机(可选)')).not.toBeInTheDocument()
expect(screen.queryByLabelText('启动命令(可选)')).not.toBeInTheDocument()
await user.clear(screen.getByLabelText('主机'))
await user.type(screen.getByLabelText('主机'), 'win.lab.local')
await user.click(screen.getByRole('button', { name: '创建并保存' }))