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

some more commands

This commit is contained in:
Leibale
2023-04-30 10:08:25 -04:00
parent 2c4dc95a44
commit 53b9397a78
8 changed files with 259 additions and 243 deletions

View File

@@ -1,26 +1,22 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './SETNX';
import SETNX from './SETNX';
describe('SETNX', () => {
it('transformArguments', () => {
assert.deepEqual(
transformArguments('key', 'value'),
['SETNX', 'key', 'value']
);
});
it('transformArguments', () => {
assert.deepEqual(
SETNX.transformArguments('key', 'value'),
['SETNX', 'key', 'value']
);
});
testUtils.testWithClient('client.setNX', async client => {
assert.equal(
await client.setNX('key', 'value'),
true
);
}, GLOBAL.SERVERS.OPEN);
testUtils.testWithCluster('cluster.setNX', async cluster => {
assert.equal(
await cluster.setNX('key', 'value'),
true
);
}, GLOBAL.CLUSTERS.OPEN);
testUtils.testAll('setNX', async client => {
assert.equal(
await client.setNX('key', 'value'),
1
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});