1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00
Files
node-redis/packages/client/lib/commands/SPOP.spec.ts
Nikolay Karadzhov 742d5713e8 fix(commands): sPopCount return Array<string> (#3006)
Also, touch the tests for spop and spopcount
to use the new parseCommand API

fixes #3004
2025-06-25 13:15:44 +03:00

39 lines
789 B
TypeScript

import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import SPOP from './SPOP';
import { BasicCommandParser } from '../client/parser';
describe('SPOP', () => {
it('transformArguments', () => {
const parser = new BasicCommandParser();
SPOP.parseCommand(parser, 'key');
assert.deepEqual(
parser.redisArgs,
['SPOP', 'key']
);
});
testUtils.testAll('sPop', async client => {
assert.equal(
await client.sPop('key'),
null
);
await client.sAdd('key', 'member');
assert.equal(
await client.sPop('key'),
'member'
);
assert.equal(
await client.sPop('key'),
null
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});