From 4e490f605849f5f3cd7e6c18820287f0b1fa7657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 22 Apr 2021 11:28:10 -0400 Subject: [PATCH] test: fix redis tests --- src/database/redis/hash.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/database/redis/hash.js b/src/database/redis/hash.js index 3a83b861fe..42a1fccffc 100644 --- a/src/database/redis/hash.js +++ b/src/database/redis/hash.js @@ -98,9 +98,7 @@ module.exports = function (module) { if (!Array.isArray(keys) || !keys.length) { return []; } - if (!Array.isArray(fields)) { - return keys.map(() => ({})); - } + const cachedData = {}; const unCachedKeys = cache.getUnCachedKeys(keys, cachedData); @@ -118,7 +116,7 @@ module.exports = function (module) { cache.set(key, cachedData[key]); }); - if (!fields.length) { + if (!Array.isArray(fields) || !fields.length) { return keys.map(key => (cachedData[key] ? { ...cachedData[key] } : null)); } return keys.map((key) => {