Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.

Commit 6c115c0

Browse files
author
Martin Wentzel
committed
Adds first tests.
1 parent 94d082d commit 6c115c0

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

test/test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { SSHConnection } from '../dist/Connection'
2+
import * as fs from 'fs'
3+
4+
describe('node-ssh-forward', async () => {
5+
describe('Connect to a server', async () => {
6+
it('with default path to the private key', async () => {
7+
const ssh = new SSHConnection({
8+
username: 'root',
9+
endHost: 'server'
10+
})
11+
await ssh.executeCommand('uptime')
12+
})
13+
it.skip('with default path to the private key and ssh agent enabled ', async () => {
14+
const ssh = new SSHConnection({
15+
username: 'root',
16+
endHost: 'server',
17+
agentForward: true
18+
})
19+
await ssh.executeCommand('uptime')
20+
})
21+
it('with custom path to the private key', async () => {
22+
const ssh = new SSHConnection({
23+
username: 'root',
24+
endHost: 'server',
25+
privateKey: fs.readFileSync(`${__dirname}/keys/id_rsa_no_pass`),
26+
})
27+
await ssh.executeCommand('uptime')
28+
})
29+
it('with a passphrase protected private key', async () => {
30+
const ssh = new SSHConnection({
31+
username: 'root',
32+
endHost: 'server',
33+
privateKey: fs.readFileSync(`${__dirname}/keys/id_rsa_pass`),
34+
passphrase: 'passphrase'
35+
})
36+
await ssh.executeCommand('uptime')
37+
})
38+
})
39+
})

0 commit comments

Comments
 (0)