Files

15 lines
593 B
TypeScript

import { describe, expect, it } from 'vitest'
import { formatSshLinkTarget } from '../../src/utils/sshLink'
describe('formatSshLinkTarget', () => {
it('formats default and custom ports', () => {
expect(formatSshLinkTarget({ host: 'example.com', port: 22, username: 'root' })).toBe('root@example.com')
expect(formatSshLinkTarget({ host: 'example.com', port: 2222, username: 'admin' })).toBe('admin@example.com:2222')
})
it('keeps IPv6 unambiguous', () => {
expect(formatSshLinkTarget({ host: '2001:db8::1', port: 22, username: 'root' })).toBe('root@[2001:db8::1]')
})
})