2016-07-06 01:14:44 +00:00
|
|
|
import "typings-test";
|
2016-07-13 11:04:48 +00:00
|
|
|
import path = require("path");
|
2016-07-06 01:14:44 +00:00
|
|
|
import "should";
|
2016-07-13 11:04:48 +00:00
|
|
|
import {Qenv} from "qenv";
|
2016-07-06 04:33:31 +00:00
|
|
|
import * as smartnginx from "../dist/index";
|
|
|
|
|
2016-07-13 11:04:48 +00:00
|
|
|
// setup environment
|
|
|
|
let testQenv = new Qenv(process.cwd(),path.join(process.cwd(),".nogit"));
|
2016-07-06 04:33:31 +00:00
|
|
|
describe("smartnginx",function(){
|
|
|
|
let testNginxConfig:smartnginx.NginxConfig;
|
|
|
|
let testNginxZone01:smartnginx.NginxZone;
|
2016-07-06 06:30:33 +00:00
|
|
|
let testNginxZone02:smartnginx.NginxZone;
|
|
|
|
describe("NginxZone",function(){
|
|
|
|
it(`"new NginxZone()" should produce an instance of NginxConfig`,function(){
|
|
|
|
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(){
|
|
|
|
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-13 11:04:48 +00:00
|
|
|
this.timeout(240000);
|
|
|
|
it("should deploy a config from an instance",function(done){
|
|
|
|
testNginxConfig.deploy()
|
|
|
|
.then(() => {
|
|
|
|
done();
|
|
|
|
});
|
2016-07-08 02:24:07 +00:00
|
|
|
})
|
|
|
|
});
|
2016-07-06 06:30:33 +00:00
|
|
|
});
|
2016-07-06 04:33:31 +00:00
|
|
|
});
|