@ -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);