-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: declaration of sshConfig.find()
fixes #54
- Loading branch information
Showing
14 changed files
with
110 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ coverage | |
node_modules | ||
package-lock.json | ||
.nyc_output | ||
|
||
test/types/*.js | ||
test/types/*.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ language: node_js | |
node_js: | ||
- "node" | ||
- "lts/*" | ||
- "10" | ||
|
||
after_success: | ||
- npm install coveralls | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import SSHConfig from '../..' | ||
import { strict as assert } from 'assert' | ||
|
||
describe('SSHConfig (TypeScript)', function() { | ||
let config: SSHConfig | ||
|
||
beforeEach(function() { | ||
config = SSHConfig.parse(` | ||
IdentityFile ~/.ssh/id_rsa | ||
Host ness | ||
HostName lochness.com | ||
`) | ||
}) | ||
|
||
it('.find(line => boolean)', function() { | ||
const section = config.find(line => line.type === SSHConfig.DIRECTIVE && line.param === 'Host' && line.value === 'ness') | ||
assert.equal(section.type, SSHConfig.DIRECTIVE) | ||
assert.equal(section.param, 'Host') | ||
assert.equal(section.value, 'ness') | ||
}) | ||
|
||
it('.find({ Host })', function() { | ||
const section = config.find({ Host: 'ness' }) | ||
assert.equal(section.type, SSHConfig.DIRECTIVE) | ||
if ('config' in section) { | ||
assert.deepEqual(SSHConfig.stringify(section.config).trim(), 'HostName lochness.com') | ||
} | ||
}) | ||
|
||
it('.compute(host)', function() { | ||
const result = config.compute('ness'); | ||
console.log(result) | ||
assert.deepEqual(result, { | ||
Host: 'ness', | ||
HostName: 'lochness.com', | ||
IdentityFile: [ '~/.ssh/id_rsa' ], | ||
}) | ||
}) | ||
|
||
it('.stringify(config)', function() { | ||
assert.deepEqual(config.toString(), ` | ||
IdentityFile ~/.ssh/id_rsa | ||
Host ness | ||
HostName lochness.com | ||
`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2018", | ||
"moduleResolution": "Node", | ||
"module": "CommonJS", | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"esModuleInterop": true, | ||
"sourceMap": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.