feat: release OpsXShell 2.1.0 native Tauri edition
This commit is contained in:
1 parent
e9a0d21758
commit
a3dba0c6ed
311 files changed
+31748
-14897
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { usePoolStore } from '../../src/stores/connection/poolStore'
|
||||
import type { PooledConnection } from '../../src/stores/connection/types'
|
||||
|
||||
function connection(connectionId: string): PooledConnection {
|
||||
return {
|
||||
connectionId,
|
||||
config: { host: 'opsbase.cn', port: 55555, username: 'root' },
|
||||
state: 'connected',
|
||||
refCount: 1,
|
||||
tabIds: new Set(['tab-a']),
|
||||
activeTabId: 'tab-a',
|
||||
shellIds: new Set(['shell-a']),
|
||||
sftpIds: new Set(),
|
||||
stats: { connectedAt: Date.now(), lastActivityAt: Date.now(), bytesTransferred: 0, commandsExecuted: 0 },
|
||||
keepaliveInterval: 1,
|
||||
reconnectAttempts: 0,
|
||||
maxReconnectAttempts: 3,
|
||||
}
|
||||
}
|
||||
|
||||
afterEach(() => usePoolStore.setState({ connections: new Map() }))
|
||||
|
||||
describe('native connection close', () => {
|
||||
it('removes the stale renderer connection without another SSH disconnect', () => {
|
||||
const clearIntervalSpy = vi.spyOn(window, 'clearInterval')
|
||||
usePoolStore.setState({ connections: new Map([['native-gone', connection('native-gone')]]) })
|
||||
|
||||
usePoolStore.getState().forgetNativeConnection('native-gone')
|
||||
|
||||
expect(usePoolStore.getState().connections.has('native-gone')).toBe(false)
|
||||
expect(clearIntervalSpy).toHaveBeenCalled()
|
||||
clearIntervalSpy.mockRestore()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user