feat: release OpsXShell 2.1.1

This commit is contained in:
Logan.Li committed 2026-07-31 01:37:01 +08:00
1 parent a3dba0c6ed
commit 494ef6b9d0
37 files changed
+2039 -370

No files matched your search

+26
View File
@@ -19,6 +19,32 @@ function deferred<T>() {
}
describe('Tauri event subscriptions', () => {
it('maps a shell close event without treating the pooled connection as closed', async () => {
const unlisten = vi.fn()
let dispatch: ((event: { payload: unknown }) => void) | undefined
listenMock.mockImplementationOnce(async (_channel, callback) => {
dispatch = callback
return unlisten
})
const listener = vi.fn()
desktopApi.onShellClosed(listener)
await Promise.resolve()
dispatch?.({
payload: {
connectionId: 'connection-1',
shellId: 'shell-2',
reason: '远端 Shell 因空闲策略(TMOUT)自动退出',
idleTimeout: true,
},
})
expect(listener).toHaveBeenCalledWith({}, 'connection-1', 'shell-2', {
reason: '远端 Shell 因空闲策略(TMOUT)自动退出',
idleTimeout: true,
})
})
it('safely unregisters when React cleans up before listen resolves', async () => {
const pending = deferred<() => void>()
const unlisten = vi.fn()