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,27 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { ErrorCode, handleError } from '../../src/utils/error-handler'
|
||||
|
||||
vi.mock('../../src/utils/logger', () => ({
|
||||
logger: { error: vi.fn() },
|
||||
}))
|
||||
|
||||
describe('connection error classification', () => {
|
||||
it.each([
|
||||
'connection timed out',
|
||||
'SSH handshake timeout',
|
||||
'连接超时',
|
||||
])('classifies timeout: %s', (message) => {
|
||||
expect(handleError(new Error(message)).code).toBe(ErrorCode.CONNECTION_TIMEOUT)
|
||||
})
|
||||
|
||||
it.each([
|
||||
'getaddrinfo ENOTFOUND host.invalid',
|
||||
'无法解析主机 host.invalid',
|
||||
])('classifies DNS failures: %s', (message) => {
|
||||
expect(handleError(new Error(message)).code).toBe(ErrorCode.HOST_UNREACHABLE)
|
||||
})
|
||||
|
||||
it('classifies connection refusal separately from timeout', () => {
|
||||
expect(handleError(new Error('Connection refused')).code).toBe(ErrorCode.CONNECTION_FAILED)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user