Skip to content

Commit

Permalink
test: fix redis tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Apr 22, 2021
1 parent 92de49b commit 4e490f6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/database/redis/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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) => {
Expand Down

0 comments on commit 4e490f6

Please sign in to comment.