mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 01:56:12 +01:00
Zincrybulk (#9975)
* feat: zincry bulk * feat: psql bulk incr placeholder * test: redis test fix * test: redis test
This commit is contained in:
committed by
GitHub
parent
d9c42c000c
commit
6ea3b51f12
@@ -1024,6 +1024,47 @@ describe('Sorted Set methods', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should increment fields of sorted sets with a single call', async () => {
|
||||
const data = await db.sortedSetIncrByBulk([
|
||||
['sortedIncrBulk1', 1, 'value1'],
|
||||
['sortedIncrBulk2', 2, 'value2'],
|
||||
['sortedIncrBulk3', 3, 'value3'],
|
||||
['sortedIncrBulk3', 4, 'value4'],
|
||||
]);
|
||||
assert.deepStrictEqual(data, [1, 2, 3, 4]);
|
||||
assert.deepStrictEqual(
|
||||
await db.getSortedSetRangeWithScores('sortedIncrBulk1', 0, -1),
|
||||
[{ value: 'value1', score: 1 }],
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
await db.getSortedSetRangeWithScores('sortedIncrBulk2', 0, -1),
|
||||
[{ value: 'value2', score: 2 }],
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
await db.getSortedSetRangeWithScores('sortedIncrBulk3', 0, -1),
|
||||
[
|
||||
{ value: 'value3', score: 3 },
|
||||
{ value: 'value4', score: 4 },
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
it('should increment the same field', async () => {
|
||||
const data1 = await db.sortedSetIncrByBulk([
|
||||
['sortedIncrBulk5', 5, 'value5'],
|
||||
]);
|
||||
|
||||
const data2 = await db.sortedSetIncrByBulk([
|
||||
['sortedIncrBulk5', 5, 'value5'],
|
||||
]);
|
||||
assert.deepStrictEqual(
|
||||
await db.getSortedSetRangeWithScores('sortedIncrBulk5', 0, -1),
|
||||
[
|
||||
{ value: 'value5', score: 10 },
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user