Skip to content

Add support for client reply command #2503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/client/lib/client/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import * as CLIENT_KILL from '../commands/CLIENT_KILL';
import * as CLIENT_LIST from '../commands/CLIENT_LIST';
import * as CLIENT_NO_EVICT from '../commands/CLIENT_NO-EVICT';
import * as CLIENT_PAUSE from '../commands/CLIENT_PAUSE';
import * as CLIENT_REPLY from '../commands/CLIENT_REPLY';
import * as CLIENT_SETNAME from '../commands/CLIENT_SETNAME';
import * as CLIENT_TRACKING from '../commands/CLIENT_TRACKING';
import * as CLIENT_TRACKINGINFO from '../commands/CLIENT_TRACKINGINFO';
Expand Down Expand Up @@ -170,6 +171,8 @@ export default {
clientList: CLIENT_LIST,
CLIENT_PAUSE,
clientPause: CLIENT_PAUSE,
CLIENT_REPLY,
clientReply: CLIENT_REPLY,
CLIENT_SETNAME,
clientSetName: CLIENT_SETNAME,
CLIENT_TRACKING,
Expand Down
35 changes: 35 additions & 0 deletions packages/client/lib/commands/CLIENT_REPLY.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CLIENT_REPLY';

describe('CLIENT REPLY', () => {
describe('transformArguments', () => {
it('on', () => {
assert.deepEqual(
transformArguments('ON'),
['CLIENT', 'REPLY', 'ON']
);
});

it('off', () => {
assert.deepEqual(
transformArguments('OFF'),
['CLIENT', 'REPLY', 'OFF']
);
});

it('skip', () => {
assert.deepEqual(
transformArguments('SKIP'),
['CLIENT', 'REPLY', 'SKIP']
);
});
});

testUtils.testWithClient('client.clientReply', async client => {
assert.equal(
await client.clientReply('ON'),
'OK'
);
}, GLOBAL.SERVERS.OPEN);
});
13 changes: 13 additions & 0 deletions packages/client/lib/commands/CLIENT_REPLY.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { RedisCommandArguments } from '.';

export function transformArguments(
mode: 'ON' | 'OFF' | 'SKIP'
): RedisCommandArguments {
return [
'CLIENT',
'REPLY',
mode
];
}

export declare function transformReply(): null | 'OK';