Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
e8f3047ac0 | |||
812d28ee3d | |||
fa301eea71 | |||
48ccf317d6 |
9
dist/smartssh.classes.sshinstance.js
vendored
9
dist/smartssh.classes.sshinstance.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"mode":"default",
|
"mode":"default"
|
||||||
"coverageTreshold":50
|
|
||||||
}
|
}
|
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "smartssh",
|
"name": "smartssh",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"description": "setups SSH quickly and in a painless manner",
|
"description": "setups SSH quickly and in a painless manner",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(npmts)"
|
||||||
},
|
},
|
||||||
|
26
test/test.js
26
test/test.js
File diff suppressed because one or more lines are too long
26
test/test.ts
26
test/test.ts
@ -4,7 +4,29 @@ import smartssh = require("../dist/index");
|
|||||||
describe("smartssh",function(){
|
describe("smartssh",function(){
|
||||||
let testSshInstance:smartssh.SshInstance;
|
let testSshInstance:smartssh.SshInstance;
|
||||||
let testSshKey:smartssh.SshKey;
|
let testSshKey:smartssh.SshKey;
|
||||||
describe("SshInstance",function(){
|
describe(".SshKey",function(){
|
||||||
|
it("'new' keyword should create a valid SshKey object",function(){
|
||||||
|
testSshKey = new smartssh.SshKey({
|
||||||
|
host:"example.com",
|
||||||
|
private:"someExamplePrivateKey",
|
||||||
|
public:"someExamplePublicKey"
|
||||||
|
});
|
||||||
|
testSshKey.should.be.instanceof(smartssh.SshKey);
|
||||||
|
});
|
||||||
|
it(".type should be a valid type",function(){
|
||||||
|
testSshKey.type.should.equal("duplex");
|
||||||
|
});
|
||||||
|
it(".publicKey should be public key",function(){
|
||||||
|
testSshKey.publicKey.should.equal("someExamplePublicKey");
|
||||||
|
});
|
||||||
|
it(".privateKey should be private key",function(){
|
||||||
|
testSshKey.privateKey.should.equal("someExamplePrivateKey");
|
||||||
|
});
|
||||||
|
it(".publicKeyBase64 should be public key base 64 encoded",function(){
|
||||||
|
testSshKey.publicKeyBase64;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
describe(".SshInstance",function(){
|
||||||
it("'new' keyword should create a new SshInstance object from class",function(){
|
it("'new' keyword should create a new SshInstance object from class",function(){
|
||||||
testSshInstance = new smartssh.SshInstance();
|
testSshInstance = new smartssh.SshInstance();
|
||||||
testSshInstance.should.be.instanceof(smartssh.SshInstance);
|
testSshInstance.should.be.instanceof(smartssh.SshInstance);
|
||||||
@ -40,5 +62,5 @@ describe("smartssh",function(){
|
|||||||
testSshInstance.removeKey(testSshInstance.getKey("bitbucket.org"));
|
testSshInstance.removeKey(testSshInstance.getKey("bitbucket.org"));
|
||||||
testSshInstance.sshKeys[1].host.should.equal("github.com");
|
testSshInstance.sshKeys[1].host.should.equal("github.com");
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
})
|
})
|
@ -35,10 +35,8 @@ export class SshInstance {
|
|||||||
};
|
};
|
||||||
replaceKey(sshKeyOldArg:SshKey,sshKeyNewArg:SshKey){
|
replaceKey(sshKeyOldArg:SshKey,sshKeyNewArg:SshKey){
|
||||||
this.sync("from");
|
this.sync("from");
|
||||||
let filteredArray = this.sshKeyArray.filter((sshKeyArg:SshKey) => {
|
this.removeKey(sshKeyOldArg);
|
||||||
return (sshKeyArg.host == "some"); //TODO
|
this.addKey(sshKeyNewArg);
|
||||||
});
|
|
||||||
this.sshKeyArray = filteredArray;
|
|
||||||
this.sync("to");
|
this.sync("to");
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -55,6 +53,7 @@ export class SshInstance {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
get sshKeys():SshKey[] {
|
get sshKeys():SshKey[] {
|
||||||
|
this.sync("from");
|
||||||
return this.sshKeyArray;
|
return this.sshKeyArray;
|
||||||
}
|
}
|
||||||
sync(directionArg:string){
|
sync(directionArg:string){
|
||||||
|
Reference in New Issue
Block a user