You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
fix DECRBY
This commit is contained in:
@@ -1,19 +1,22 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
import { transformArguments } from './DECRBY';
|
import DECRBY from './DECRBY';
|
||||||
|
|
||||||
describe('DECRBY', () => {
|
describe('DECRBY', () => {
|
||||||
it('transformArguments', () => {
|
it('transformArguments', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('key', 2),
|
DECRBY.transformArguments('key', 2),
|
||||||
['DECRBY', 'key', '2']
|
['DECRBY', 'key', '2']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testUtils.testWithClient('client.decrBy', async client => {
|
testUtils.testAll('decrBy', async client => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await client.decrBy('key', 2),
|
await client.decrBy('key', 2),
|
||||||
-2
|
-2
|
||||||
);
|
);
|
||||||
}, GLOBAL.SERVERS.OPEN);
|
}, {
|
||||||
|
client: GLOBAL.SERVERS.OPEN,
|
||||||
|
cluster: GLOBAL.CLUSTERS.OPEN
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -3,7 +3,7 @@ import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
|||||||
export default {
|
export default {
|
||||||
FIRST_KEY_INDEX: 1,
|
FIRST_KEY_INDEX: 1,
|
||||||
transformArguments(key: RedisArgument, decrement: number) {
|
transformArguments(key: RedisArgument, decrement: number) {
|
||||||
return ['DECR', key, decrement.toString()];
|
return ['DECRBY', key, decrement.toString()];
|
||||||
},
|
},
|
||||||
transformReply: undefined as unknown as () => NumberReply
|
transformReply: undefined as unknown as () => NumberReply
|
||||||
} as const satisfies Command;
|
} as const satisfies Command;
|
||||||
|
Reference in New Issue
Block a user