smartnginx/test/test.ts

46 lines
1.4 KiB
TypeScript

import { tap, expect } from '@pushrocks/tapbundle';
import path = require('path');
import { Qenv } from 'qenv';
let testQenv = new Qenv(process.cwd(), path.join(process.cwd(), '.nogit'));
import * as smartnginx from '../ts';
let testSmartNginx: smartnginx.SmartNginx;
let testNginxZone01: smartnginx.NginxHost;
let testNginxZone02: smartnginx.NginxHost;
tap.test('should create a valid instance of SmartNginx', async () => {
testSmartNginx = new smartnginx.SmartNginx();
expect(testSmartNginx).to.be.instanceof(smartnginx.SmartNginx);
});
tap.test(`should produce an instance of NginxConfig`, async () => {
testNginxZone01 = new smartnginx.NginxHost(testSmartNginx, {
hostName: 'test100.bleu.de',
destination: '192.192.192.191'
});
testNginxZone02 = new smartnginx.NginxHost(testSmartNginx, {
hostName: 'test102.bleu.de',
destination: '192.192.192.192'
});
expect(testNginxZone01).to.be.instanceof(smartnginx.NginxHost);
console.log(testNginxZone01.configString);
});
tap.test('.addZone() should add a zone to NginxConfig Object', async () => {
testSmartNginx.addHost(testNginxZone01);
testSmartNginx.addHost(testNginxZone02);
});
tap.test('.deploy() should deploy a config from an instance', async () => {
await testSmartNginx.deploy();
});
tap.test('.stop() should end the process', async () => {
testSmartNginx.nginxProcess.stop();
});
tap.start();