1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-13 10:02:24 +03:00
Files
node-redis/lib/commands/BZPOPMAX.spec.ts
2021-06-15 19:27:41 -04:00

47 lines
1.2 KiB
TypeScript

import { strict as assert } from 'assert';
import { TestRedisServers, itWithClient } from '../test-utils';
import { transformArguments } from './BZPOPMAX';
import RedisClient from '../client';
describe('BZPOPMAX', () => {
describe('transformArguments', () => {
it('single', () => {
assert.deepEqual(
transformArguments('key', 0),
['BZPOPMAX', 'key', '0']
);
});
it('multiple', () => {
assert.deepEqual(
transformArguments(['1', '2'], 0),
['BZPOPMAX', '1', '2', '0']
);
});
});
itWithClient(TestRedisServers.OPEN, 'client.bzPopMax', async client => {
const [popReply] = await Promise.all([
client.bzPopMax(RedisClient.commandOptions({
duplicateConnection: true
}), 'key', 0),
client.zAdd('key', [{
value: '1',
score: 1
}, {
value: '2',
score: 2
}])
]);
assert.deepEqual(
popReply,
{
key: 'key',
value: '2',
score: 2
}
);
});
});