smartnginx/test/test.ts

54 lines
1.6 KiB
TypeScript
Raw Normal View History

import { tap, expect } from '@pushrocks/tapbundle';
import path = require('path');
2019-01-09 13:13:32 +00:00
import { Qenv } from '@pushrocks/qenv';
const testQenv = new Qenv('./', './.nogit/');
2019-01-09 13:13:32 +00:00
import * as smartnginx from '../ts/index';
let testSmartNginx: smartnginx.SmartNginx;
let testNginxZone01: smartnginx.NginxHost;
let testNginxZone02: smartnginx.NginxHost;
tap.test('should create a valid instance of SmartNginx', async () => {
2019-01-09 11:15:28 +00:00
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',
2019-01-09 11:15:28 +00:00
destination: '192.192.192.191',
privateKey: 'some private',
publicKey: 'some public'
});
testNginxZone02 = new smartnginx.NginxHost(testSmartNginx, {
hostName: 'test102.bleu.de',
2019-01-09 11:15:28 +00:00
destination: '192.192.192.192',
privateKey: 'some private',
publicKey: 'some public'
});
expect(testNginxZone01).to.be.instanceof(smartnginx.NginxHost);
2016-07-06 04:33:31 +00:00
});
2019-01-17 23:45:29 +00:00
tap.test('.addHostCandidate() should add a zone to NginxConfig Object', async () => {
testSmartNginx.addHostCandidate(testNginxZone01);
testSmartNginx.addHostCandidate(testNginxZone02);
});
tap.test('.deploy() should deploy a config from an instance', async () => {
await testSmartNginx.deploy();
});
2019-01-18 00:33:01 +00:00
tap.test('should not redeploy', async () => {
testSmartNginx.addHostCandidate(testNginxZone01);
testSmartNginx.addHostCandidate(testNginxZone02);
await testSmartNginx.deploy();
});
tap.test('.stop() should end the process', async () => {
testSmartNginx.nginxProcess.stop();
});
tap.start();