reverseproxy: async'ify

This commit is contained in:
Girish Ramakrishnan
2021-08-17 14:04:29 -07:00
parent 5bcf1bc47b
commit 5dd6f85025
10 changed files with 212 additions and 292 deletions

View File

@@ -121,15 +121,15 @@ describe('Reverse Proxy', function () {
});
});
describe('generateFallbackCertificiate', function () {
describe('generateFallbackCertificate', function () {
let domainObject = {
domain: 'cool.com',
config: {}
};
let result;
it('can generate fallback certs', function () {
result = reverseProxy.generateFallbackCertificateSync(domainObject.domain);
it('can generate fallback certs', async function () {
result = await reverseProxy.generateFallbackCertificate(domainObject.domain);
expect(result).to.be.ok();
expect(result.error).to.be(null);
});
@@ -175,20 +175,14 @@ describe('Reverse Proxy', function () {
await domains.update(domainCopy.domain, domainCopy, auditSource);
});
it('configure nginx correctly', function (done) {
reverseProxy.configureApp(app, auditSource, function (error) {
expect(fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + app.id + '.conf'));
expect(error).to.be(null);
done();
});
it('configure nginx correctly', async function () {
await reverseProxy.configureApp(app, auditSource);
expect(fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + app.id + '.conf'));
});
it('unconfigure nginx', function (done) {
reverseProxy.unconfigureApp(app, function (error) {
expect(!fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + app.id + '.conf'));
expect(error).to.be(null);
done();
});
it('unconfigure nginx', async function () {
await reverseProxy.unconfigureApp(app);
expect(!fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + app.id + '.conf'));
});
});
});