chore: 保存工作副本——客户端授权新契约(双端点/验签/令牌/周检)与桌面会话可靠性改进
This commit is contained in:
1 parent
f71eef0eba
commit
ae6093c9b3
163 files changed
+4911
-2494
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { TabContextMenu } from '../../src/components/layout/tabbar/TabContextMenu'
|
||||
import { tabSupportsReconnect } from '../../src/utils/tabReconnect'
|
||||
|
||||
describe('TabContextMenu', () => {
|
||||
it('lists SFTP, clone, reconnect, then close actions', () => {
|
||||
const onReconnect = vi.fn()
|
||||
render(
|
||||
<TabContextMenu
|
||||
isOpen
|
||||
position={{ x: 8, y: 8 }}
|
||||
onClose={vi.fn()}
|
||||
onCloseTab={vi.fn()}
|
||||
onCloseOthers={vi.fn()}
|
||||
onCloseRight={vi.fn()}
|
||||
onCloseLeft={vi.fn()}
|
||||
onCloseAll={vi.fn()}
|
||||
onClone={vi.fn()}
|
||||
onOpenSftp={vi.fn()}
|
||||
onReconnect={onReconnect}
|
||||
/>
|
||||
)
|
||||
|
||||
const labels = screen.getAllByRole('button').map((button) => button.textContent)
|
||||
expect(labels.slice(0, 4)).toEqual(['打开 SFTP', '克隆标签', '重新连接', '关闭'])
|
||||
fireEvent.click(screen.getByRole('button', { name: '重新连接' }))
|
||||
expect(onReconnect).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('offers reconnect for SSH / SFTP / desktop tabs only', () => {
|
||||
expect(tabSupportsReconnect({ type: 'terminal' })).toBe(true)
|
||||
expect(tabSupportsReconnect({ type: 'sftp' })).toBe(true)
|
||||
expect(tabSupportsReconnect({ type: 'rdp' })).toBe(true)
|
||||
expect(tabSupportsReconnect({ type: 'welcome' })).toBe(false)
|
||||
expect(tabSupportsReconnect({ type: 'settings' })).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user