1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +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', 'key', '1']
);
});
it('with set option', () => {
assert.deepEqual(
transformArguments('key', 1, 'NX'),
['EXPIRE', 'key', '1', 'NX']
);
});
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
EXPIRE.transformArguments('key', 1),
['EXPIRE', 'key', '1']
);
});
testUtils.testWithClient('client.expire', async client => {
assert.equal(
await client.expire('key', 0),
false
);
}, GLOBAL.SERVERS.OPEN);
it('with set option', () => {
assert.deepEqual(
EXPIRE.transformArguments('key', 1, 'NX'),
['EXPIRE', 'key', '1', 'NX']
);
});
});
testUtils.testAll('expire', async client => {
assert.equal(
await client.expire('key', 0),
false
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});