fix: tests on redis

This commit is contained in:
Barış Soner Uşaklı
2020-05-16 22:49:34 -04:00
parent 8bf980cb63
commit 7a801abade
2 changed files with 7 additions and 0 deletions

View File

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

View File

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