mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 12:31:33 +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:
@@ -12,6 +12,13 @@ module.exports = function (db, module) {
|
||||
});
|
||||
};
|
||||
|
||||
module.emptydb = function (callback) {
|
||||
callback = callback || helpers.noop;
|
||||
db.collection('objects').remove({}, function (err) {
|
||||
callback(err);
|
||||
});
|
||||
};
|
||||
|
||||
module.exists = function (key, callback) {
|
||||
if (!key) {
|
||||
return callback();
|
||||
|
||||
@@ -10,6 +10,10 @@ module.exports = function (redisClient, module) {
|
||||
});
|
||||
};
|
||||
|
||||
module.emptydb = function (callback) {
|
||||
module.flushdb(callback);
|
||||
};
|
||||
|
||||
module.exists = function (key, callback) {
|
||||
redisClient.exists(key, function (err, exists) {
|
||||
callback(err, exists === 1);
|
||||
|
||||
Reference in New Issue
Block a user