1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

fix #2090 - topK.listWithCount (#2091)

This commit is contained in:
Leibale Eidelman
2022-04-25 05:48:02 -04:00
committed by GitHub
parent e6de453fdd
commit 448ac9daae
5 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../../test-utils';
import { transformArguments } from './LIST_WITHCOUNT';
describe('TOPK LIST WITHCOUNT', () => {
testUtils.isVersionGreaterThanHook([2, 2, 9]);
it('transformArguments', () => {
assert.deepEqual(
transformArguments('key'),
['TOPK.LIST', 'key', 'WITHCOUNT']
);
});
testUtils.testWithClient('client.topK.listWithCount', async client => {
const [,, list] = await Promise.all([
client.topK.reserve('key', 3),
client.topK.add('key', 'item'),
client.topK.listWithCount('key')
]);
assert.deepEqual(
list,
[{
item: 'item',
count: 1
}]
);
}, GLOBAL.SERVERS.OPEN);
});