You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
31 lines
857 B
TypeScript
31 lines
857 B
TypeScript
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);
|
|
});
|