smartcert/test/test.js

38 lines
4.4 KiB
JavaScript
Raw Normal View History

2016-06-21 18:04:44 +00:00
"use strict";
require("typings-test");
require("should");
var qenv_1 = require("qenv");
2016-06-28 07:32:01 +00:00
var path = require("path");
2016-06-22 11:22:09 +00:00
var install_1 = require("../dist/install");
var cert = require("../dist/index");
2016-06-21 18:04:44 +00:00
var testQenv = new qenv_1.Qenv(process.cwd(), process.cwd() + "/.nogit");
2016-06-22 11:22:09 +00:00
var testCert;
describe("cert", function () {
describe("install", function () {
it("should download letsencrypt.sh", function (done) {
this.timeout(5000);
install_1.startInstall().then(function () {
done();
});
});
});
describe("Cert", function () {
2016-06-28 03:53:49 +00:00
it("should create a new Cert object from class", function () {
2016-06-22 11:22:09 +00:00
testCert = new cert.Cert({
cfEmail: process.env.CF_EMAIL,
cfKey: process.env.CF_KEY,
2016-06-28 07:32:01 +00:00
sslDir: path.join(process.cwd(), "test/assets")
2016-06-22 11:22:09 +00:00
});
testCert.should.be.instanceof(cert.Cert);
});
it("should get a valid certificate", function (done) {
this.timeout(120000);
testCert.getDomainCert("sub9.bleu.de").then(function () {
2016-06-22 11:22:09 +00:00
done();
});
});
});
});
2016-06-21 18:04:44 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUNoQixxQkFBbUIsTUFBTSxDQUFDLENBQUE7QUFDMUIsSUFBTyxJQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFFOUIsd0JBQTJCLGlCQUFpQixDQUFDLENBQUE7QUFDN0MsSUFBWSxJQUFJLFdBQU0sZUFBZSxDQUFDLENBQUE7QUFHdEMsSUFBSSxRQUFRLEdBQUcsSUFBSSxXQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsRUF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9tIGNsYXNzXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RDZXJ0ID0gbmV3IGNlcnQuQ2VydCh7XG4gICAgICAgICAgICAgICAgY2ZFbWFpbDogcHJvY2Vzcy5lbnYuQ0ZfRU1BSUwsXG4gICAgICAgICAgICAgICAgY2ZLZXk6IHByb2Nlc3MuZW52LkNGX0tFWSxcbiAgICAgICAgICAgICAgICBzc2xEaXI6IHBhdGguam9pbihwcm9jZXNzLmN3ZCgpLFwidGVzdC9hc3NldHNcIilcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgdGVzdENlcnQuc2hvdWxkLmJlLmluc3RhbmNlb2YoY2VydC5DZXJ0KTtcbiAgICAgICAgfSlcbiAgICAgICAgaXQoXCJzaG91bGQgZ2V0IGEgdmFsaWQgY2VydGlmaWNhdGVcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgIHRoaXMudGltZW91dCgxMjAwMDApO1xuICAgICAgICAgICAgdGVzdENlcnQuZ2V0RG9tYWluQ2VydChcInN1YjkuYmxldS5kZVwiKS50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSlcbiAgICB9KVxufSk7Il19