smartcert/test/test.js

47 lines
4.2 KiB
JavaScript
Raw Normal View History

2016-06-21 18:04:44 +00:00
"use strict";
require("typings-test");
require("should");
2016-07-21 12:58:05 +00:00
const qenv_1 = require("qenv");
const path = require("path");
const q = require("q");
const install_1 = require("../dist/install");
const cert = require("../dist/index");
let testQenv = new qenv_1.Qenv(process.cwd(), process.cwd() + "/.nogit");
let testCert;
2016-06-22 11:22:09 +00:00
describe("cert", function () {
describe("install", function () {
it("should download letsencrypt.sh", function (done) {
this.timeout(5000);
2016-07-21 12:58:05 +00:00
install_1.startInstall().then(() => {
2016-06-22 11:22:09 +00:00
done();
});
});
});
describe("Cert", function () {
2016-06-28 03:53:49 +00:00
it("should create a new Cert object from class", function () {
2016-07-13 14:06:16 +00:00
this.timeout(40000);
2016-06-22 11:22:09 +00:00
testCert = new cert.Cert({
cfEmail: process.env.CF_EMAIL,
cfKey: process.env.CF_KEY,
2016-07-04 02:56:49 +00:00
sslDir: path.join(process.cwd(), "test/assets"),
2016-07-04 19:57:14 +00:00
gitOriginRepo: "git@gitlab.com:sandboxzone/sandbox-sslorigin.git",
2016-07-04 06:41:58 +00:00
testMode: true
2016-06-22 11:22:09 +00:00
});
testCert.should.be.instanceof(cert.Cert);
});
it("should get a valid certificate", function (done) {
2016-07-24 18:17:23 +00:00
this.timeout(1200000);
2016-07-21 12:58:05 +00:00
let promiseArray = [];
2016-07-22 01:28:30 +00:00
function getRandomArbitrary(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
promiseArray.push(testCert.getDomainCert(`testing${getRandomArbitrary(1, 100000)}.bleu.de`));
promiseArray.push(testCert.getDomainCert(`testing${getRandomArbitrary(1, 100000)}.bleu.de`));
promiseArray.push(testCert.getDomainCert(`testing${getRandomArbitrary(1, 100000)}.bleu.de`));
2016-07-21 12:58:05 +00:00
q.all(promiseArray).then(() => {
2016-06-22 11:22:09 +00:00
done();
});
});
});
});
2016-07-24 18:17:23 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZX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