1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

fix #1912 - CLIENT PAUSE (#2125)

* fix #1912 - CLIENT PAUSE

* fix client pause

* Update commands.ts
This commit is contained in:
Leibale Eidelman
2022-05-11 10:02:29 -04:00
committed by GitHub
parent 53a96ccce4
commit 94dbcc847b
3 changed files with 53 additions and 2 deletions

View File

@ -0,0 +1,28 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CLIENT_PAUSE';
describe('CLIENT PAUSE', () => {
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
transformArguments(0),
['CLIENT', 'PAUSE', '0']
);
});
it('with mode', () => {
assert.deepEqual(
transformArguments(0, 'ALL'),
['CLIENT', 'PAUSE', '0', 'ALL']
);
});
});
testUtils.testWithClient('client.clientPause', async client => {
assert.equal(
await client.clientPause(0),
'OK'
);
}, GLOBAL.SERVERS.OPEN);
});

View File

@ -0,0 +1,20 @@
import { RedisCommandArguments } from '.';
export function transformArguments(
timeout: number,
mode?: 'WRITE' | 'ALL'
): RedisCommandArguments {
const args = [
'CLIENT',
'PAUSE',
timeout.toString()
];
if (mode) {
args.push(mode);
}
return args;
}
export declare function transformReply(): 'OK' | Buffer;