You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import { strict as assert } from 'node:assert';
|
|
import testUtils, { GLOBAL } from '../test-utils';
|
|
import LMPOP from './LMPOP';
|
|
|
|
describe('LMPOP', () => {
|
|
testUtils.isVersionGreaterThanHook([7]);
|
|
|
|
describe('transformArguments', () => {
|
|
it('simple', () => {
|
|
assert.deepEqual(
|
|
LMPOP.transformArguments('key', 'LEFT'),
|
|
['LMPOP', '1', 'key', 'LEFT']
|
|
);
|
|
});
|
|
|
|
it('with COUNT', () => {
|
|
assert.deepEqual(
|
|
LMPOP.transformArguments('key', 'LEFT', {
|
|
COUNT: 2
|
|
}),
|
|
['LMPOP', '1', 'key', 'LEFT', 'COUNT', '2']
|
|
);
|
|
});
|
|
});
|
|
|
|
testUtils.testAll('lmPop - null', async client => {
|
|
assert.equal(
|
|
await client.lmPop('key', 'RIGHT'),
|
|
null
|
|
);
|
|
}, {
|
|
client: GLOBAL.SERVERS.OPEN,
|
|
cluster: GLOBAL.SERVERS.OPEN
|
|
});
|
|
|
|
testUtils.testAll('lmPop - with member', async client => {
|
|
const [, reply] = await Promise.all([
|
|
client.lPush('key', 'element'),
|
|
client.lmPop('key', 'RIGHT')
|
|
]);
|
|
|
|
assert.deepEqual(reply, [
|
|
'key',
|
|
['element']
|
|
]);
|
|
}, {
|
|
client: GLOBAL.SERVERS.OPEN,
|
|
cluster: GLOBAL.SERVERS.OPEN
|
|
});
|
|
});
|