You've already forked node-redis
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:
33
packages/client/lib/commands/HPERSIST.spec.ts
Normal file
33
packages/client/lib/commands/HPERSIST.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { strict as assert } from 'node:assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './HPERSIST';
|
||||
import { HASH_EXPIRATION_TIME } from './HEXPIRETIME';
|
||||
|
||||
describe('HPERSIST', () => {
|
||||
testUtils.isVersionGreaterThanHook([7, 4]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('string', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', 'field'),
|
||||
['HPERSIST', 'key', 'FIELDS', '1', 'field']
|
||||
);
|
||||
});
|
||||
|
||||
it('array', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', ['field1', 'field2']),
|
||||
['HPERSIST', 'key', 'FIELDS', '2', 'field1', 'field2']
|
||||
);
|
||||
});
|
||||
})
|
||||
|
||||
testUtils.testWithClient('hPersist', async client => {
|
||||
assert.deepEqual(
|
||||
await client.hPersist('key', 'field1'),
|
||||
[ HASH_EXPIRATION_TIME.FieldNotExists ]
|
||||
);
|
||||
}, {
|
||||
...GLOBAL.SERVERS.OPEN,
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user