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