Skip to content

Commit f965c8f

Browse files
committed
cluster with commandOptions unit test
1 parent 6c5de79 commit f965c8f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/client/lib/cluster/index.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { strict as assert } from 'assert';
22
import testUtils, { GLOBAL, waitTillBeenCalled } from '../test-utils';
33
import RedisCluster from '.';
44
import { ClusterSlotStates } from '../commands/CLUSTER_SETSLOT';
5+
import { commandOptions } from '../command-options';
56
import { SQUARE_SCRIPT } from '../client/index.spec';
67
import { RootNodesUnavailableError } from '../errors';
78
import { spy } from 'sinon';
@@ -178,6 +179,20 @@ describe('Cluster', () => {
178179
await assert.rejects(cluster.mGet(['a', 'b']));
179180
}, GLOBAL.CLUSTERS.OPEN);
180181

182+
testUtils.testWithCluster('commandOptions', async cluster => {
183+
const key = `test-${Math.random()}`; // random() for random cluster slot
184+
185+
const [ blPopReply ] = await Promise.all([
186+
cluster.blPop(commandOptions({ isolated: true }), key, 1),
187+
cluster.lPush(key, 'element'),
188+
]);
189+
190+
assert.deepEqual(
191+
blPopReply,
192+
{ key, element: 'element' }
193+
);
194+
}, GLOBAL.CLUSTERS.OPEN);
195+
181196
describe('minimizeConnections', () => {
182197
testUtils.testWithCluster('false', async cluster => {
183198
for (const master of cluster.masters) {

0 commit comments

Comments
 (0)