1
0
mirror of https://github.com/redis/node-redis.git synced 2025-12-11 09:22:35 +03:00

fix(ts): xtrim threshold accepts string (#3058)

* fix(ts): xtrim threshold accepts string

* test: check MINID with text id
This commit is contained in:
Manuel Spigolon
2025-08-18 10:22:44 +02:00
committed by GitHub
parent fceb60968e
commit ed6aca7d03
2 changed files with 16 additions and 1 deletions

View File

@@ -18,6 +18,11 @@ describe('XTRIM', () => {
parseArgs(XTRIM, 'key', 'MINID', 123), parseArgs(XTRIM, 'key', 'MINID', 123),
['XTRIM', 'key', 'MINID', '123'] ['XTRIM', 'key', 'MINID', '123']
); );
assert.deepEqual(
parseArgs(XTRIM, 'key', 'MINID', '0-0'),
['XTRIM', 'key', 'MINID', '0-0']
);
}); });
it('with strategyModifier', () => { it('with strategyModifier', () => {
@@ -89,6 +94,16 @@ describe('XTRIM', () => {
cluster: GLOBAL.CLUSTERS.OPEN, cluster: GLOBAL.CLUSTERS.OPEN,
}); });
testUtils.testAll('xTrim with string MINID', async client => {
assert.equal(
typeof await client.xTrim('key', 'MINID', '0-0'),
'number'
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN,
});
testUtils.testAll( testUtils.testAll(
'xTrim with LIMIT', 'xTrim with LIMIT',
async (client) => { async (client) => {

View File

@@ -37,7 +37,7 @@ export default {
parser: CommandParser, parser: CommandParser,
key: RedisArgument, key: RedisArgument,
strategy: 'MAXLEN' | 'MINID', strategy: 'MAXLEN' | 'MINID',
threshold: number, threshold: number | string,
options?: XTrimOptions options?: XTrimOptions
) { ) {
parser.push('XTRIM') parser.push('XTRIM')