2015-12-10 20:31:38 -08:00
|
|
|
/* global it:false */
|
2026-02-14 09:53:14 +01:00
|
|
|
|
2026-02-14 15:43:24 +01:00
|
|
|
import common from './common.js';
|
|
|
|
|
import domains from '../domains.js';
|
2026-02-14 09:53:14 +01:00
|
|
|
import expect from 'expect.js';
|
|
|
|
|
import fs from 'node:fs';
|
|
|
|
|
import paths from '../paths.js';
|
2026-02-14 15:43:24 +01:00
|
|
|
import reverseProxy from '../reverseproxy.js';
|
2026-02-14 09:53:14 +01:00
|
|
|
|
2015-12-10 20:31:38 -08:00
|
|
|
/* global describe:false */
|
|
|
|
|
/* global before:false */
|
|
|
|
|
/* global after:false */
|
|
|
|
|
|
2021-08-13 17:22:28 -07:00
|
|
|
describe('Reverse Proxy', function () {
|
2022-11-28 21:23:06 +01:00
|
|
|
const { setup, cleanup, domain, auditSource, app } = common;
|
2021-08-13 10:41:10 -07:00
|
|
|
const domainCopy = Object.assign({}, domain);
|
|
|
|
|
|
|
|
|
|
before(setup);
|
|
|
|
|
after(cleanup);
|
2021-06-03 12:20:44 -07:00
|
|
|
|
|
|
|
|
describe('configureApp', function () {
|
2021-08-13 17:22:28 -07:00
|
|
|
before(async function () {
|
2021-08-13 10:41:10 -07:00
|
|
|
domainCopy.tlsConfig = { provider: 'fallback' };
|
2021-06-03 16:16:04 -07:00
|
|
|
|
2021-12-03 13:46:54 -08:00
|
|
|
await domains.setConfig(domainCopy.domain, domainCopy, auditSource);
|
2021-06-03 16:16:04 -07:00
|
|
|
});
|
|
|
|
|
|
2021-08-17 14:04:29 -07:00
|
|
|
it('configure nginx correctly', async function () {
|
|
|
|
|
await reverseProxy.configureApp(app, auditSource);
|
|
|
|
|
expect(fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + app.id + '.conf'));
|
2021-06-03 12:20:44 -07:00
|
|
|
});
|
|
|
|
|
|
2021-08-17 14:04:29 -07:00
|
|
|
it('unconfigure nginx', async function () {
|
|
|
|
|
await reverseProxy.unconfigureApp(app);
|
|
|
|
|
expect(!fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + app.id + '.conf'));
|
2021-06-03 12:20:44 -07:00
|
|
|
});
|
|
|
|
|
});
|
2015-12-10 20:31:38 -08:00
|
|
|
});
|