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

fix EXISTS spec

This commit is contained in:
dovi
2023-05-02 19:34:49 -04:00
parent 98c1a1d235
commit 6809365e98
3 changed files with 36 additions and 27 deletions

View File

@@ -1,28 +1,31 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './EXISTS';
import EXISTS from './EXISTS';
describe('EXISTS', () => {
describe('transformArguments', () => {
it('string', () => {
assert.deepEqual(
transformArguments('key'),
['EXISTS', 'key']
);
});
it('array', () => {
assert.deepEqual(
transformArguments(['1', '2']),
['EXISTS', '1', '2']
);
});
describe('transformArguments', () => {
it('string', () => {
assert.deepEqual(
EXISTS.transformArguments('key'),
['EXISTS', 'key']
);
});
testUtils.testWithClient('client.exists', async client => {
assert.equal(
await client.exists('key'),
0
);
}, GLOBAL.SERVERS.OPEN);
it('array', () => {
assert.deepEqual(
EXISTS.transformArguments(['1', '2']),
['EXISTS', '1', '2']
);
});
});
testUtils.testAll('exists', async client => {
assert.equal(
await client.exists('key'),
0
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});

View File

@@ -92,6 +92,7 @@ import MGET from './MGET';
import MSET from './MSET';
import MSETNX from './MSETNX';
import PERSIST from './PERSIST';
import EXISTS from './EXISTS';
import PEXPIRE from './PEXPIRE';
import PEXPIREAT from './PEXPIREAT';
import PEXPIRETIME from './PEXPIRETIME';
@@ -366,6 +367,8 @@ export default {
mSetNX: MSETNX,
PERSIST,
persist: PERSIST,
EXISTS,
exists: EXISTS,
PEXPIRE,
pExpire: PEXPIRE,
PEXPIREAT,