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,40 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { parseSshTarget } from '../../src/components/sessions/QuickConnectDialog'
|
||||
|
||||
describe('parseSshTarget', () => {
|
||||
it('解析 host', () => {
|
||||
expect(parseSshTarget('192.168.1.1')).toEqual({
|
||||
host: '192.168.1.1',
|
||||
port: 22,
|
||||
username: 'root',
|
||||
})
|
||||
})
|
||||
|
||||
it('解析 user@host', () => {
|
||||
expect(parseSshTarget('ubuntu@opsbase.cn')).toEqual({
|
||||
host: 'opsbase.cn',
|
||||
port: 22,
|
||||
username: 'ubuntu',
|
||||
})
|
||||
})
|
||||
|
||||
it('解析 user@host:port', () => {
|
||||
expect(parseSshTarget('root@opsbase.cn:5555')).toEqual({
|
||||
host: 'opsbase.cn',
|
||||
port: 5555,
|
||||
username: 'root',
|
||||
})
|
||||
})
|
||||
|
||||
it('解析 host:port', () => {
|
||||
expect(parseSshTarget('example.com:2222')).toEqual({
|
||||
host: 'example.com',
|
||||
port: 2222,
|
||||
username: 'root',
|
||||
})
|
||||
})
|
||||
|
||||
it('空串返回 null', () => {
|
||||
expect(parseSshTarget(' ')).toBeNull()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user