mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: tests on redis
This commit is contained in:
@@ -154,6 +154,9 @@ module.exports = function (module) {
|
||||
};
|
||||
|
||||
module.deleteObjectFields = async function (key, fields) {
|
||||
if (!Array.isArray(fields) || !fields.length) {
|
||||
return;
|
||||
}
|
||||
await module.client.async.hdel(key, fields);
|
||||
cache.delObjectCache(key);
|
||||
};
|
||||
|
||||
@@ -410,6 +410,10 @@ describe('Hash methods', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should not error if fields is empty array', async () => {
|
||||
await db.deleteObjectFields('someKey', []);
|
||||
});
|
||||
|
||||
it('should not error if key is undefined', function (done) {
|
||||
db.deleteObjectField(undefined, 'someField', function (err) {
|
||||
assert.ifError(err);
|
||||
|
||||
Reference in New Issue
Block a user