1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

fix(commands): sPopCount return Array<string> (#3006)

Also, touch the tests for spop and spopcount
to use the new parseCommand API

fixes #3004
This commit is contained in:
Nikolay Karadzhov
2025-06-25 13:15:44 +03:00
committed by GitHub
parent c5b4f47975
commit 742d5713e8
3 changed files with 36 additions and 6 deletions

View File

@@ -1,21 +1,36 @@
import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import SPOP_COUNT from './SPOP_COUNT';
import { parseArgs } from './generic-transformers';
import { BasicCommandParser } from '../client/parser';
describe('SPOP_COUNT', () => {
it('transformArguments', () => {
const parser = new BasicCommandParser();
SPOP_COUNT.parseCommand(parser, 'key', 1);
assert.deepEqual(
parseArgs(SPOP_COUNT, 'key', 1),
parser.redisArgs,
['SPOP', 'key', '1']
);
});
testUtils.testAll('sPopCount', async client => {
assert.deepEqual(
await client.sPopCount('key', 1),
[]
);
await Promise.all([
client.sAdd('key', 'member'),
client.sAdd('key', 'member2'),
client.sAdd('key', 'member3')
])
assert.deepEqual(
(await client.sPopCount('key', 3)).length,
3
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN