smartnginx/test/test.ts

51 lines
1.8 KiB
TypeScript

import "typings-test";
import path = require("path");
import "should";
import {Qenv} from "qenv";
import * as smartnginx from "../dist/index";
// setup environment
let testQenv = new Qenv(process.cwd(),path.join(process.cwd(),".nogit"));
console.log(process.env.CF_EMAIL);
console.log(process.env.CF_KEY);
describe("smartnginx",function(){
let testNginxConfig:smartnginx.NginxConfig;
let testNginxZone01:smartnginx.NginxZone;
let testNginxZone02:smartnginx.NginxZone;
describe("NginxZone",function(){
it(`"new NginxZone()" should produce an instance of NginxConfig`,function(){
testNginxZone01 = new smartnginx.NginxZone({
zoneName:"test100.bleu.de",
type:smartnginx.zoneTypes.reverseProxy,
destination:"192.192.192.192"
});
testNginxZone01.should.be.instanceof(smartnginx.NginxZone);
console.log(testNginxZone01.configString);
});
});
describe("NginxConfig",function(){
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
});
testNginxConfig.should.be.instanceof(smartnginx.NginxConfig);
});
describe(".addZone()",function(){
it("should add a zone to NginxConfig Object",function(){
testNginxConfig.addZone(testNginxZone01);
})
});
describe(".deploy()",function(){
this.timeout(240000);
it("should deploy a config from an instance",function(done){
testNginxConfig.deploy()
.then(() => {
done();
});
})
});
});
});