smartnginx/test/test.js

61 lines
4.8 KiB
JavaScript
Raw Normal View History

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");
// 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 () {
testNginxZone01 = new smartnginx.NginxHost({
hostName: "test100.bleu.de",
type: smartnginx.hostTypes.reverseProxy,
destination: "192.192.192.191"
});
testNginxZone02 = new smartnginx.NginxHost({
hostName: "test102.bleu.de",
type: smartnginx.hostTypes.reverseProxy,
2016-07-06 06:30:33 +00:00
destination: "192.192.192.192"
});
testNginxZone01.should.be.instanceof(smartnginx.NginxHost);
2016-07-06 06:30:33 +00:00
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 () {
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.addHost(testNginxZone01);
testNginxConfig.addHost(testNginxZone02);
2016-07-08 02:24:07 +00:00
});
});
describe(".deploy()", function () {
2016-07-24 23:54:36 +00:00
this.timeout(600000);
it("should deploy a config from an instance", function (done) {
testNginxConfig.deploy()
2016-07-21 00:24:54 +00:00
.then(() => {
done();
});
2016-07-08 02:24:07 +00:00
});
});
2016-07-25 00:57:17 +00:00
describe(".stop", function () {
it("should end the process", function () {
testNginxConfig.nginxProcess.stop();
});
});
2016-07-06 04:33:31 +00:00
});
});
2016-07-25 00:57:17 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsTUFBTyxJQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDOUIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUNoQix1QkFBbUIsTUFBTSxDQUFDLENBQUE7QUFDMUIsTUFBWSxVQUFVLFdBQU0sZUFBZSxDQUFDLENBQUE7QUFFNUMsb0JBQW9CO0FBQ3BCLElBQUksUUFBUSxHQUFHLElBQUksV0FBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsRUFBQyxJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsRUFBQyxRQUFRLENBQUMsQ0FBQyxDQUFDO0FBQ3pFLFFBQVEsQ0FBQyxZQUFZLEVBQUM7SUFDbEIsSUFBSSxlQUFzQyxDQUFDO0lBQzNDLElBQUksZUFBb0MsQ0FBQztJQUN6QyxJQUFJLGVBQW9DLENBQUM7SUFDekMsUUFBUSxDQUFDLFdBQVcsRUFBQztRQUNqQixFQUFFLENBQUMsNkRBQTZELEVBQUM7WUFDN0QsZUFBZSxHQUFHLElBQUksVUFBVSxDQUFDLFNBQVMsQ0FBQztnQkFDdkMsUUFBUSxFQUFDLGlCQUFpQjtnQkFDMUIsSUFBSSxFQUFDLFVBQVUsQ0FBQyxTQUFTLENBQUMsWU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