This repository was archived by the owner on Aug 26, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 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+ } )
You can’t perform that action at this time.
0 commit comments