smartssh/test/test.js
2016-06-01 02:48:38 +02:00

37 lines
4.4 KiB
JavaScript

"use strict";
require("typings-test");
require("should");
var smartssh = require("../dist/index");
describe("smartssh", function () {
var testSshInstance;
var testSshKey;
describe("SshInstance", function () {
it("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 () {
testSshInstance.addKey(new smartssh.SshKey({
public: "somePublicKey",
private: "somePrivateKey",
host: "gitlab.com"
}));
testSshInstance.addKey(new smartssh.SshKey({
public: "somePublicKey",
private: "somePrivateKey",
host: "bitbucket.org"
}));
testSshInstance.addKey(new smartssh.SshKey({
public: "somePublicKey",
private: "somePrivateKey",
host: "github.com"
}));
});
it("should return an array of sshKeys", function () {
testSshInstance.getKeys();
});
});
});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLFFBQU8sUUFBUSxDQUFDLENBQUE7QUFDaEIsSUFBTyxRQUFRLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFDM0MsUUFBUSxDQUFDLFVBQVUsRUFBQztJQUNoQixJQUFJLGVBQW9DLENBQUM7SUFDekMsSUFBSSxVQUEwQixDQUFDO0lBQy9CLFFBQVEsQ0FBQyxhQUFhLEVBQUM7UUFDbkIsRUFBRSxDQUFDLG1EQUFtRCxFQUFDO1lBQ25ELGVBQWUsR0FBRyxJQUFJLFFBQVEsQ0FBQyxXQUFXLEVBQUUsQ0FBQztZQUM3QyxlQUFlLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsUUFBUSxDQUFDLFdBQVcsQ0FBQyxDQUFDO1FBQy9ELENBQUMsQ0FBQyxDQUFDO1FBQ0gsRUFBRSxDQUFDLG1DQUFtQyxFQU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mV3IHNtYXJ0c3NoLlNzaEtleSh7XHJcbiAgICAgICAgICAgICAgICBwdWJsaWM6XCJzb21lUHVibGljS2V5XCIsXHJcbiAgICAgICAgICAgICAgICBwcml2YXRlOlwic29tZVByaXZhdGVLZXlcIixcclxuICAgICAgICAgICAgICAgIGhvc3Q6XCJnaXRodWIuY29tXCJcclxuICAgICAgICAgICAgfSkpO1xyXG4gICAgICAgIH0pO1xyXG4gICAgICAgIGl0KFwic2hvdWxkIHJldHVybiBhbiBhcnJheSBvZiBzc2hLZXlzXCIsZnVuY3Rpb24oKXtcclxuICAgICAgICAgICAgdGVzdFNzaEluc3RhbmNlLmdldEtleXMoKTtcclxuICAgICAgICB9KTtcclxuICAgIH0pXHJcbn0pIl19