import { describe, expect, it } from 'vitest' import { parseSshConfig } from '../../src/utils/sshConfig' describe('parseSshConfig', () => { it('imports concrete hosts and common connection fields', () => { const sessions = parseSshConfig(` Host bastion HostName gateway.example.com User ops IdentityFile ~/.ssh/ops_ed25519 Host production prod-short HostName 10.10.0.8 Port 2222 User root ProxyJump bastion `) expect(sessions).toEqual([ { name: 'bastion', host: 'gateway.example.com', port: 22, username: 'ops', authType: 'key', privateKey: '~/.ssh/ops_ed25519', proxyJumpAlias: undefined, group: 'SSH Config', }, expect.objectContaining({ name: 'production', host: '10.10.0.8', port: 2222, username: 'root', authType: 'agent', proxyJumpAlias: 'bastion', }), expect.objectContaining({ name: 'prod-short', proxyJumpAlias: 'bastion' }), ]) }) it('skips wildcard and negated host patterns', () => { const sessions = parseSshConfig(` Host * ServerAliveInterval 30 Host !blocked *.internal User deploy Host usable HostName usable.example.com `) expect(sessions).toHaveLength(1) expect(sessions[0].name).toBe('usable') }) })