mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
search tests
new method emptydb use emptydb instead of flushdb, flushdb removes indices for mongo which breaks search tests initialize meta.config properly in tests enable nodebb-plugin-dbsearch for tests
This commit is contained in:
@@ -90,13 +90,23 @@
|
||||
db.init(next);
|
||||
},
|
||||
function (next) {
|
||||
db.flushdb(next);
|
||||
db.emptydb(next);
|
||||
},
|
||||
function (next) {
|
||||
winston.info('test_database flushed');
|
||||
meta = require('../../src/meta');
|
||||
setupDefaultConfigs(meta, next);
|
||||
},
|
||||
function (next) {
|
||||
meta.configs.init(next);
|
||||
},
|
||||
function (next) {
|
||||
meta.config.postDelay = 0;
|
||||
meta.config.initialPostDelay = 0;
|
||||
meta.config.newbiePostDelay = 0;
|
||||
|
||||
enableDefaultPlugins(next);
|
||||
},
|
||||
function (next) {
|
||||
// nconf defaults, if not set in config
|
||||
if (!nconf.get('upload_path')) {
|
||||
@@ -131,6 +141,26 @@
|
||||
], done);
|
||||
});
|
||||
|
||||
function setupDefaultConfigs(meta, next) {
|
||||
winston.info('Populating database with default configs, if not already set...\n');
|
||||
|
||||
var defaults = require(path.join(nconf.get('base_dir'), 'install/data/defaults.json'));
|
||||
|
||||
meta.configs.setOnEmpty(defaults, next);
|
||||
}
|
||||
|
||||
function enableDefaultPlugins(callback) {
|
||||
winston.info('Enabling default plugins\n');
|
||||
|
||||
var defaultEnabled = [
|
||||
'nodebb-plugin-dbsearch'
|
||||
];
|
||||
|
||||
winston.info('[install/enableDefaultPlugins] activating default plugins', defaultEnabled);
|
||||
|
||||
db.sortedSetAdd('plugins:active', [0], defaultEnabled, callback);
|
||||
}
|
||||
|
||||
module.exports = db;
|
||||
|
||||
}(module));
|
||||
|
||||
Reference in New Issue
Block a user