1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00
This commit is contained in:
Leibale
2023-06-22 19:41:35 -04:00
parent 6059b1edd8
commit e95634b375
6 changed files with 281 additions and 202 deletions

View File

@@ -0,0 +1,46 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import ZRANK_WITHSCORE from './ZRANK_WITHSCORE';
describe('ZRANK WITHSCORE', () => {
testUtils.isVersionGreaterThanHook([7, 2]);
it('transformArguments', () => {
assert.deepEqual(
ZRANK_WITHSCORE.transformArguments('key', 'member'),
['ZRANK', 'key', 'member', 'WITHSCORE']
);
});
testUtils.testAll('zRankWithScore - null', async client => {
assert.equal(
await client.zRankWithScore('key', 'member'),
null
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
testUtils.testAll('zRankWithScore - with member', async client => {
const member = {
value: '1',
score: 1
}
const [, reply] = await Promise.all([
client.zAdd('key', member),
client.zRankWithScore('key', member.value)
])
assert.deepEqual(
reply,
{
rank: 0,
score: 1
}
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});