fix: sortedSetIncrByBulk null response

This commit is contained in:
Julian Lam
2026-03-25 15:22:26 -04:00
parent 2a9e529d9c
commit 2a8efd4f8c
2 changed files with 8 additions and 2 deletions

View File

@@ -261,6 +261,10 @@ module.exports = function (module) {
};
module.sortedSetIncrByBulk = async function (data) {
if (!Array.isArray(data) || !data.length) {
return [];
}
const multi = module.client.multi();
data.forEach((item) => {
multi.zIncrBy(item[0], item[1], String(item[2]));

View File

@@ -1061,8 +1061,10 @@ NUMERIC)-- WsPn&query[cid]=-1&parentCid=0&selectedCids[]=-1&privilege=topics:rea
this.set = utils.generateUUID();
});
it('should throw', async function () {
await assert.rejects(db.sortedSetIncrByBulk(this.set, []));
it('should return empty array', async function () {
const response = await db.sortedSetIncrByBulk(this.set, []);
assert(Array.isArray(response));
assert.strictEqual(response.length, 0);
});
});