1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-11 22:42:42 +03:00
Files
node-redis/lib/commands/BLPOP.spec.ts
2021-05-25 09:51:48 -04:00

39 lines
1.1 KiB
TypeScript

import { strict as assert } from 'assert';
import { TestRedisServers, itWithClient } from '../test-utils';
import { transformArguments } from './BLPOP';
import RedisClient from '../client';
describe('BLPOP', () => {
describe('transformArguments', () => {
it('single', () => {
assert.deepEqual(
transformArguments('key', 0),
['BLPOP', 'key', '0']
);
});
it('multiple', () => {
assert.deepEqual(
transformArguments(['key1', 'key2'], 0),
['BLPOP', 'key1', 'key2', '0']
);
});
});
itWithClient(TestRedisServers.OPEN, 'client.blPop', async client => {
const [popReply, pushReply] = await Promise.all([
client.blPop(RedisClient.commandOptions({
duplicateConnection: true
}), 'key', 0),
client.lPush('key', ['1', '2'])
]);
assert.deepEqual(
popReply,
['key', '2']
);
assert.equal(pushReply, 2);
});
});