Skip to content

Commit ed6aca7

Browse files
authored
fix(ts): xtrim threshold accepts string (#3058)
* fix(ts): xtrim threshold accepts string * test: check MINID with text id
1 parent fceb609 commit ed6aca7

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ describe('XTRIM', () => {
1818
parseArgs(XTRIM, 'key', 'MINID', 123),
1919
['XTRIM', 'key', 'MINID', '123']
2020
);
21+
22+
assert.deepEqual(
23+
parseArgs(XTRIM, 'key', 'MINID', '0-0'),
24+
['XTRIM', 'key', 'MINID', '0-0']
25+
);
2126
});
2227

2328
it('with strategyModifier', () => {
@@ -89,6 +94,16 @@ describe('XTRIM', () => {
8994
cluster: GLOBAL.CLUSTERS.OPEN,
9095
});
9196

97+
testUtils.testAll('xTrim with string MINID', async client => {
98+
assert.equal(
99+
typeof await client.xTrim('key', 'MINID', '0-0'),
100+
'number'
101+
);
102+
}, {
103+
client: GLOBAL.SERVERS.OPEN,
104+
cluster: GLOBAL.CLUSTERS.OPEN,
105+
});
106+
92107
testUtils.testAll(
93108
'xTrim with LIMIT',
94109
async (client) => {

packages/client/lib/commands/XTRIM.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default {
3737
parser: CommandParser,
3838
key: RedisArgument,
3939
strategy: 'MAXLEN' | 'MINID',
40-
threshold: number,
40+
threshold: number | string,
4141
options?: XTrimOptions
4242
) {
4343
parser.push('XTRIM')

0 commit comments

Comments
 (0)