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

add support for all hash field expiration commands (#2787)

This commit is contained in:
Shaya Potter
2024-07-10 19:44:30 +03:00
committed by GitHub
parent 72345fe1a2
commit b4df2b24a8
20 changed files with 555 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './HPTTL';
import { HASH_EXPIRATION_TIME } from './HEXPIRETIME';
describe('HPTTL', () => {
testUtils.isVersionGreaterThanHook([7, 4]);
describe('transformArguments', () => {
it('string', () => {
assert.deepEqual(
transformArguments('key', 'field'),
['HPTTL', 'key', 'FIELDS', '1', 'field']
);
});
it('array', () => {
assert.deepEqual(
transformArguments('key', ['field1', 'field2']),
['HPTTL', 'key', 'FIELDS', '2', 'field1', 'field2']
);
});
});
testUtils.testWithClient('hpTTL', async client => {
assert.deepEqual(
await client.hpTTL('key', 'field1'),
[ HASH_EXPIRATION_TIME.FieldNotExists ]
);
}, {
...GLOBAL.SERVERS.OPEN
});
});