added more tests

This commit is contained in:
2016-06-01 04:18:31 +02:00
parent 09d96fd94c
commit 78aa36c2be
10 changed files with 63 additions and 46 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,11 +5,11 @@ describe("smartssh",function(){
let testSshInstance:smartssh.SshInstance;
let testSshKey:smartssh.SshKey;
describe("SshInstance",function(){
it("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.should.be.instanceof(smartssh.SshInstance);
});
it("should accept a new SshKey object",function(){
it(".addKey() should accept a new SshKey object",function(){
testSshInstance.addKey(new smartssh.SshKey({
public:"somePublicKey",
private:"somePrivateKey",
@ -21,15 +21,24 @@ describe("smartssh",function(){
host:"bitbucket.org"
}));
testSshInstance.addKey(new smartssh.SshKey({
public:"somePublicKey",
private:"somePrivateKey",
public:"someGitHubPublicKey",
private:"someGitHubPrivateKey",
host:"github.com"
}));
});
it("should return an array of sshKeys",function(){
it(".sshKeys should point to an array of sshKeys",function(){
let sshKeyArray = testSshInstance.sshKeys;
sshKeyArray.should.be.Array();
sshKeyArray[0].host.should.equal("gitlab.com");
sshKeyArray[1].host.should.equal("bitbucket.org");
sshKeyArray[2].host.should.equal("github.com");
});
it(".getKey() should get a specific key selected by host",function(){
testSshInstance.getKey("github.com").publicKey.should.equal("someGitHubPublicKey");
})
it(".removeKey() should remove a key",function(){
testSshInstance.removeKey(testSshInstance.getKey("bitbucket.org"));
testSshInstance.sshKeys[1].host.should.equal("github.com");
})
})
})