1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
This commit is contained in:
Leibale
2023-06-29 14:39:49 -04:00
parent ea2d9d2a77
commit c109fbf751
36 changed files with 584 additions and 720 deletions

View File

@@ -1,43 +1,35 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './BLMOVE';
import { commandOptions } from '../../index';
import BLMOVE from './BLMOVE';
describe('BLMOVE', () => {
testUtils.isVersionGreaterThanHook([6, 2]);
testUtils.isVersionGreaterThanHook([6, 2]);
it('transformArguments', () => {
assert.deepEqual(
transformArguments('source', 'destination', 'LEFT', 'RIGHT', 0),
['BLMOVE', 'source', 'destination', 'LEFT', 'RIGHT', '0']
);
});
it('transformArguments', () => {
assert.deepEqual(
BLMOVE.transformArguments('source', 'destination', 'LEFT', 'RIGHT', 0),
['BLMOVE', 'source', 'destination', 'LEFT', 'RIGHT', '0']
);
});
testUtils.testWithClient('client.blMove', async client => {
const [blMoveReply] = await Promise.all([
client.blMove(commandOptions({
isolated: true
}), 'source', 'destination', 'LEFT', 'RIGHT', 0),
client.lPush('source', 'element')
]);
testUtils.testAll('blMove - null', async client => {
assert.equal(
await client.blMove('{tag}source', '{tag}destination', 'LEFT', 'RIGHT', Number.MIN_VALUE),
null
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
assert.equal(
blMoveReply,
'element'
);
}, GLOBAL.SERVERS.OPEN);
testUtils.testWithCluster('cluster.blMove', async cluster => {
const [blMoveReply] = await Promise.all([
cluster.blMove(commandOptions({
isolated: true
}), '{tag}source', '{tag}destination', 'LEFT', 'RIGHT', 0),
cluster.lPush('{tag}source', 'element')
]);
assert.equal(
blMoveReply,
'element'
);
}, GLOBAL.CLUSTERS.OPEN);
testUtils.testAll('blMove - with member', async client => {
const [, reply] = await Promise.all([
client.lPush('{tag}source', 'element'),
client.blMove('{tag}source', '{tag}destination', 'LEFT', 'RIGHT', Number.MIN_VALUE)
]);
assert.equal(reply, 'element');
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});