lint and test timeouts for caching_middleware.js

This commit is contained in:
John McLear 2021-01-27 21:18:08 +00:00
parent fd7a7b4c6c
commit d12dbc7f63

View file

@ -1,3 +1,5 @@
'use strict';
/** /**
* caching_middleware is responsible for serving everything under path `/javascripts/` * caching_middleware is responsible for serving everything under path `/javascripts/`
* That includes packages as defined in `src/node/utils/tar.json` and probably also plugin code * That includes packages as defined in `src/node/utils/tar.json` and probably also plugin code
@ -43,6 +45,7 @@ function disableAutoDeflate(request) {
} }
describe(__filename, function () { describe(__filename, function () {
this.timeout(40000);
const backups = {}; const backups = {};
const fantasyEncoding = 'brainwaves'; // non-working encoding until https://github.com/visionmedia/superagent/pull/1560 is resolved const fantasyEncoding = 'brainwaves'; // non-working encoding until https://github.com/visionmedia/superagent/pull/1560 is resolved
const packages = [ const packages = [
@ -68,6 +71,7 @@ describe(__filename, function () {
settings.minify = false; settings.minify = false;
}); });
it('gets packages uncompressed without Accept-Encoding gzip', async function () { it('gets packages uncompressed without Accept-Encoding gzip', async function () {
this.timeout(1500);
await Promise.all(packages.map(async (resource) => agent.get(resource) await Promise.all(packages.map(async (resource) => agent.get(resource)
.set('Accept-Encoding', fantasyEncoding) .set('Accept-Encoding', fantasyEncoding)
.use(disableAutoDeflate) .use(disableAutoDeflate)
@ -80,6 +84,7 @@ describe(__filename, function () {
}); });
it('gets packages compressed with Accept-Encoding gzip', async function () { it('gets packages compressed with Accept-Encoding gzip', async function () {
this.timeout(1500);
await Promise.all(packages.map(async (resource) => agent.get(resource) await Promise.all(packages.map(async (resource) => agent.get(resource)
.set('Accept-Encoding', 'gzip') .set('Accept-Encoding', 'gzip')
.use(disableAutoDeflate) .use(disableAutoDeflate)
@ -92,6 +97,7 @@ describe(__filename, function () {
}); });
it('does not cache content-encoding headers', async function () { it('does not cache content-encoding headers', async function () {
this.timeout(1500);
await agent.get(packages[0]) await agent.get(packages[0])
.set('Accept-Encoding', fantasyEncoding) .set('Accept-Encoding', fantasyEncoding)
.then((res) => assert.equal(res.header['content-encoding'], undefined)); .then((res) => assert.equal(res.header['content-encoding'], undefined));
@ -109,6 +115,7 @@ describe(__filename, function () {
settings.minify = true; settings.minify = true;
}); });
it('gets packages uncompressed without Accept-Encoding gzip', async function () { it('gets packages uncompressed without Accept-Encoding gzip', async function () {
this.timeout(1500);
await Promise.all(packages.map(async (resource) => agent.get(resource) await Promise.all(packages.map(async (resource) => agent.get(resource)
.set('Accept-Encoding', fantasyEncoding) .set('Accept-Encoding', fantasyEncoding)
.use(disableAutoDeflate) .use(disableAutoDeflate)
@ -121,6 +128,7 @@ describe(__filename, function () {
}); });
it('gets packages compressed with Accept-Encoding gzip', async function () { it('gets packages compressed with Accept-Encoding gzip', async function () {
this.timeout(1500);
await Promise.all(packages.map(async (resource) => agent.get(resource) await Promise.all(packages.map(async (resource) => agent.get(resource)
.set('Accept-Encoding', 'gzip') .set('Accept-Encoding', 'gzip')
.use(disableAutoDeflate) .use(disableAutoDeflate)
@ -133,6 +141,7 @@ describe(__filename, function () {
}); });
it('does not cache content-encoding headers', async function () { it('does not cache content-encoding headers', async function () {
this.timeout(1500);
await agent.get(packages[0]) await agent.get(packages[0])
.set('Accept-Encoding', fantasyEncoding) .set('Accept-Encoding', fantasyEncoding)
.then((res) => assert.equal(res.header['content-encoding'], undefined)); .then((res) => assert.equal(res.header['content-encoding'], undefined));