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

fix EXPIRE spec

This commit is contained in:
dovi
2023-05-02 20:06:31 -04:00
parent 3dfea00318
commit 73994f243b
2 changed files with 27 additions and 21 deletions

View File

@@ -1,28 +1,31 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './EXPIRE';
import EXPIRE from './EXPIRE';
describe('EXPIRE', () => {
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
transformArguments('key', 1),
EXPIRE.transformArguments('key', 1),
['EXPIRE', 'key', '1']
);
});
it('with set option', () => {
assert.deepEqual(
transformArguments('key', 1, 'NX'),
EXPIRE.transformArguments('key', 1, 'NX'),
['EXPIRE', 'key', '1', 'NX']
);
});
});
testUtils.testWithClient('client.expire', async client => {
testUtils.testAll('expire', async client => {
assert.equal(
await client.expire('key', 0),
false
);
}, GLOBAL.SERVERS.OPEN);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});

View File

@@ -96,6 +96,7 @@ import MSET from './MSET';
import MSETNX from './MSETNX';
import PERSIST from './PERSIST';
import EXISTS from './EXISTS';
import EXPIRE from './EXPIRE';
import PEXPIRE from './PEXPIRE';
import PEXPIREAT from './PEXPIREAT';
import PEXPIRETIME from './PEXPIRETIME';
@@ -378,6 +379,8 @@ export default {
persist: PERSIST,
EXISTS,
exists: EXISTS,
EXPIRE,
expire: EXPIRE,
PEXPIRE,
pExpire: PEXPIRE,
PEXPIREAT,