2016-07-06 01:14:44 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-test");
|
2016-07-21 00:24:54 +00:00
|
|
|
const path = require("path");
|
2016-07-06 01:14:44 +00:00
|
|
|
require("should");
|
2016-07-21 00:24:54 +00:00
|
|
|
const qenv_1 = require("qenv");
|
|
|
|
const smartnginx = require("../dist/index");
|
2016-07-13 11:04:48 +00:00
|
|
|
// setup environment
|
2016-07-21 00:24:54 +00:00
|
|
|
let testQenv = new qenv_1.Qenv(process.cwd(), path.join(process.cwd(), ".nogit"));
|
2016-07-06 04:33:31 +00:00
|
|
|
describe("smartnginx", function () {
|
2016-07-21 00:24:54 +00:00
|
|
|
let testNginxConfig;
|
|
|
|
let testNginxZone01;
|
|
|
|
let testNginxZone02;
|
2016-07-06 06:30:33 +00:00
|
|
|
describe("NginxZone", function () {
|
2016-07-21 00:24:54 +00:00
|
|
|
it(`"new NginxZone()" should produce an instance of NginxConfig`, function () {
|
2016-07-06 06:30:33 +00:00
|
|
|
testNginxZone01 = new smartnginx.NginxZone({
|
2016-07-13 11:04:48 +00:00
|
|
|
zoneName: "test100.bleu.de",
|
2016-07-06 06:30:33 +00:00
|
|
|
type: smartnginx.zoneTypes.reverseProxy,
|
2016-07-13 14:19:00 +00:00
|
|
|
destination: "192.192.192.191"
|
|
|
|
});
|
|
|
|
testNginxZone02 = new smartnginx.NginxZone({
|
|
|
|
zoneName: "test102.bleu.de",
|
|
|
|
type: smartnginx.zoneTypes.reverseProxy,
|
2016-07-06 06:30:33 +00:00
|
|
|
destination: "192.192.192.192"
|
|
|
|
});
|
|
|
|
testNginxZone01.should.be.instanceof(smartnginx.NginxZone);
|
|
|
|
console.log(testNginxZone01.configString);
|
|
|
|
});
|
|
|
|
});
|
2016-07-06 04:33:31 +00:00
|
|
|
describe("NginxConfig", function () {
|
2016-07-24 23:54:36 +00:00
|
|
|
this.timeout(10000);
|
2016-07-21 00:24:54 +00:00
|
|
|
it(`"new NginxConfig()" should produce an instance of NginxConfig`, function () {
|
2016-07-13 11:04:48 +00:00
|
|
|
testNginxConfig = new smartnginx.NginxConfig({
|
|
|
|
cfEmail: process.env.CF_EMAIL,
|
|
|
|
cfKey: process.env.CF_KEY,
|
|
|
|
testMode: true
|
|
|
|
});
|
2016-07-06 04:33:31 +00:00
|
|
|
testNginxConfig.should.be.instanceof(smartnginx.NginxConfig);
|
|
|
|
});
|
2016-07-08 02:24:07 +00:00
|
|
|
describe(".addZone()", function () {
|
|
|
|
it("should add a zone to NginxConfig Object", function () {
|
|
|
|
testNginxConfig.addZone(testNginxZone01);
|
2016-07-13 14:19:00 +00:00
|
|
|
testNginxConfig.addZone(testNginxZone02);
|
2016-07-08 02:24:07 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
describe(".deploy()", function () {
|
2016-07-24 23:54:36 +00:00
|
|
|
this.timeout(600000);
|
2016-07-13 11:04:48 +00:00
|
|
|
it("should deploy a config from an instance", function (done) {
|
|
|
|
testNginxConfig.deploy()
|
2016-07-21 00:24:54 +00:00
|
|
|
.then(() => {
|
2016-07-13 11:04:48 +00:00
|
|
|
done();
|
|
|
|
});
|
2016-07-08 02:24:07 +00:00
|
|
|
});
|
|
|
|
});
|
2016-07-06 04:33:31 +00:00
|
|
|
});
|
|
|
|
});
|
2016-07-24 23:54:36 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsTUFBTyxJQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDOUIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUNoQix1QkFBbUIsTUFBTSxDQUFDLENBQUE7QUFDMUIsTUFBWSxVQUFVLFdBQU0sZUFBZSxDQUFDLENBQUE7QUFFNUMsb0JBQW9CO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