mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-31 05:16:45 +02:00
test: clear cache between runs, require middleware later in helpers
This commit is contained in:
committed by
Andrew Rodrigues
parent
d15e27107e
commit
2ea468daa3
@@ -176,6 +176,7 @@ async function setupMockDefaults() {
|
||||
require('../../src/groups').cache.reset();
|
||||
require('../../src/posts/cache').reset();
|
||||
require('../../src/cache').reset();
|
||||
require('../../src/middleware/uploads').clearCache();
|
||||
|
||||
winston.info('test_database flushed');
|
||||
await setupDefaultConfigs(meta);
|
||||
@@ -185,6 +186,7 @@ async function setupMockDefaults() {
|
||||
meta.config.initialPostDelay = 0;
|
||||
meta.config.newbiePostDelay = 0;
|
||||
meta.config.autoDetectLang = 0;
|
||||
// meta.config.uploadRateLimitCooldown = 1;
|
||||
|
||||
await enableDefaultPlugins();
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ describe('Upload Controllers', () => {
|
||||
it('should fail if the user exceeds the upload rate limit threshold', (done) => {
|
||||
const oldValue = meta.config.allowedFileExtensions;
|
||||
meta.config.allowedFileExtensions = 'png,jpg,bmp,html';
|
||||
|
||||
require('../src/middleware/uploads').clearCache();
|
||||
// why / 2? see: helpers.uploadFile for a weird quirk where we actually upload 2 files per upload in our tests.
|
||||
console.log('times', (meta.config.uploadRateLimitThreshold / 2) + 1);
|
||||
const times = (meta.config.uploadRateLimitThreshold / 2) + 1;
|
||||
|
||||
Reference in New Issue
Block a user