Skip to content

Commit 0e47d63

Browse files
authored
add test and clean code
1 parent efdfd0a commit 0e47d63

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

packages/client/lib/commands/CLUSTER_MYSHARDID.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { strict as assert } from 'assert';
2-
import testUtils from '../test-utils';
2+
import testUtils, { GLOBAL } from '../test-utils';
33
import { transformArguments } from './CLUSTER_MYSHARDID';
44

55
describe('CLUSTER MYSHARDID', () => {
@@ -11,4 +11,12 @@ describe('CLUSTER MYSHARDID', () => {
1111
['CLUSTER', 'MYSHARDID']
1212
);
1313
});
14+
15+
testUtils.testWithCluster('clusterNode.clusterMyShardId', async cluster => {
16+
const client = await cluster.nodeClient(cluster.masters[0]);
17+
assert.equal(
18+
typeof await client.clusterMyShardId(),
19+
'string'
20+
);
21+
}, GLOBAL.CLUSTERS.OPEN);
1422
});
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { RedisCommandArgument, RedisCommandArguments } from '.';
1+
export const IS_READ_ONLY = true;
22

3-
export function transformArguments(): RedisCommandArguments {
4-
const args: RedisCommandArguments = ['CLUSTER', 'MYSHARDID'];
5-
6-
return args;
3+
export function transformArguments() {
4+
return ['CLUSTER', 'MYSHARDID'];
75
}
86

9-
export declare function transformReply(): RedisCommandArgument;
7+
export declare function transformReply(): string | Buffer;

0 commit comments

Comments
 (0)