fix: clear header-cache after each suite

v1.18.x
Barış Soner Uşaklı 4 years ago
parent 255cf43ea9
commit 3f5f38dd89

@ -114,21 +114,11 @@ module.exports = db;
before(async function () {
this.timeout(30000);
await db.init();
await db.createIndices();
await setupMockDefaults();
await db.initSessionStore();
const meta = require('../../src/meta');
// nconf defaults, if not set in config
if (!nconf.get('sessionKey')) {
nconf.set('sessionKey', 'express.sid');
}
// Parse out the relative_url and other goodies from the configured URL
const urlObject = url.parse(nconf.get('url'));
const relativePath = urlObject.pathname !== '/' ? urlObject.pathname : '';
nconf.set('url_parsed', urlObject);
console.log('stting urlparsed');
nconf.set('base_url', urlObject.protocol + '//' + urlObject.host);
nconf.set('secure', urlObject.protocol === 'https:');
nconf.set('use_port', !!urlObject.port);
@ -136,7 +126,6 @@ before(async function () {
nconf.set('core_templates_path', path.join(__dirname, '../../src/views'));
nconf.set('base_templates_path', path.join(nconf.get('themes_path'), 'nodebb-theme-persona/templates'));
nconf.set('theme_templates_path', meta.config['theme:templates'] ? path.join(nconf.get('themes_path'), meta.config['theme:id'], meta.config['theme:templates']) : nconf.get('base_templates_path'));
nconf.set('theme_config', path.join(nconf.get('themes_path'), 'nodebb-theme-persona', 'theme.json'));
nconf.set('bcrypt_rounds', 1);
nconf.set('socket.io:origins', '*:*');
@ -144,6 +133,19 @@ before(async function () {
nconf.set('runJobs', false);
nconf.set('jobsDisabled', false);
await db.init();
await db.createIndices();
await setupMockDefaults();
await db.initSessionStore();
const meta = require('../../src/meta');
nconf.set('theme_templates_path', meta.config['theme:templates'] ? path.join(nconf.get('themes_path'), meta.config['theme:id'], meta.config['theme:templates']) : nconf.get('base_templates_path'));
// nconf defaults, if not set in config
if (!nconf.get('sessionKey')) {
nconf.set('sessionKey', 'express.sid');
}
await meta.dependencies.check();
const webserver = require('../../src/webserver');
@ -171,6 +173,8 @@ async function setupMockDefaults() {
require('../../src/groups').cache.reset();
require('../../src/posts/cache').reset();
require('../../src/cache').reset();
require('../../src/middleware').headerFooterCache.reset();
winston.info('test_database flushed');
await setupDefaultConfigs(meta);
await giveDefaultGlobalPrivileges();

Loading…
Cancel
Save