1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-10 11:43:01 +03:00
Files
node-redis/packages/bloom/lib/commands/top-k/LIST_WITHCOUNT.spec.ts
2023-09-18 15:03:07 -04:00

28 lines
744 B
TypeScript

import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../../test-utils';
import LIST_WITHCOUNT from './LIST_WITHCOUNT';
describe('TOPK.LIST WITHCOUNT', () => {
testUtils.isVersionGreaterThanHook([2, 2, 9]);
it('transformArguments', () => {
assert.deepEqual(
LIST_WITHCOUNT.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);
});