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

add support for date in both EXPIREAT & EXPIRE

This commit is contained in:
leibale
2021-06-11 14:07:55 -04:00
parent a146a9cefd
commit 10e9cbc005
4 changed files with 39 additions and 14 deletions

View File

@@ -3,11 +3,21 @@ import { TestRedisServers, itWithClient } from '../test-utils';
import { transformArguments } from './EXPIREAT';
describe('EXPIREAT', () => {
it('transformArguments', () => {
assert.deepEqual(
transformArguments('key', 1),
['EXPIRE', 'key', '1']
);
describe('transformArguments', () => {
it('number', () => {
assert.deepEqual(
transformArguments('key', 1),
['EXPIREAT', 'key', '1']
);
});
it('date', () => {
const d = new Date();
assert.deepEqual(
transformArguments('key', d),
['EXPIREAT', 'key', Math.floor(d.getTime() / 1000).toString()]
);
});
});
itWithClient(TestRedisServers.OPEN, 'client.expireAt', async client => {