mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-25 22:00:35 +01:00
fix: sortedSetIncrByBulk null response
This commit is contained in:
@@ -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]));
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user