You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-17 19:41:06 +03:00
fix CLUSTER_NODES, add some tests
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { itWithCluster, TestRedisClusters } from '../test-utils';
|
||||
import { RedisClusterNodeLinkStates, transformArguments, transformReply } from './CLUSTER_NODES';
|
||||
|
||||
describe('CLUSTER NODES', () => {
|
||||
@@ -92,4 +93,26 @@ describe('CLUSTER NODES', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
itWithCluster(TestRedisClusters.OPEN, 'cluster.clusterNodes', async cluster => {
|
||||
const nodes = await cluster.clusterNodes();
|
||||
|
||||
for (const node of (await cluster.clusterNodes())) {
|
||||
assert.equal(typeof node.id, 'string');
|
||||
assert.equal(typeof node.url, 'string');
|
||||
assert.equal(typeof node.host, 'string');
|
||||
assert.equal(typeof node.port, 'number');
|
||||
assert.equal(typeof node.cport, 'number');
|
||||
assert.ok(Array.isArray(node.flags));
|
||||
assert.equal(typeof node.pingSent, 'number');
|
||||
assert.equal(typeof node.pongRecv, 'number');
|
||||
assert.equal(typeof node.configEpoch, 'number');
|
||||
assert.equal(typeof node.linkState, 'string');
|
||||
|
||||
for (const slot of node.slots) {
|
||||
assert.equal(typeof slot.from, 'number');
|
||||
assert.equal(typeof slot.to, 'number');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user