You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import { strict as assert } from 'node:assert';
|
|
import testUtils, { GLOBAL, BLOCKING_MIN_VALUE } from '../test-utils';
|
|
import BRPOPLPUSH from './BRPOPLPUSH';
|
|
|
|
describe('BRPOPLPUSH', () => {
|
|
it('transformArguments', () => {
|
|
assert.deepEqual(
|
|
BRPOPLPUSH.transformArguments('source', 'destination', 0),
|
|
['BRPOPLPUSH', 'source', 'destination', '0']
|
|
);
|
|
});
|
|
|
|
testUtils.testAll('brPopLPush - null', async client => {
|
|
assert.equal(
|
|
await client.brPopLPush(
|
|
'{tag}source',
|
|
'{tag}destination',
|
|
BLOCKING_MIN_VALUE
|
|
),
|
|
null
|
|
);
|
|
}, {
|
|
client: GLOBAL.SERVERS.OPEN,
|
|
cluster: GLOBAL.CLUSTERS.OPEN
|
|
});
|
|
|
|
testUtils.testAll('brPopLPush - with member', async client => {
|
|
const [, reply] = await Promise.all([
|
|
client.lPush('{tag}source', 'element'),
|
|
client.brPopLPush(
|
|
'{tag}source',
|
|
'{tag}destination',
|
|
0
|
|
)
|
|
]);
|
|
|
|
assert.equal(reply, 'element');
|
|
}, {
|
|
client: GLOBAL.SERVERS.OPEN,
|
|
cluster: GLOBAL.CLUSTERS.OPEN
|
|
});
|
|
});
|