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:33:05 -04:00
parent 53b9397a78
commit 88333c01de
25 changed files with 458 additions and 491 deletions

View File

@@ -1,21 +1,24 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './RENAMENX';
import RENAMENX from './RENAMENX';
describe('RENAMENX', () => {
it('transformArguments', () => {
assert.deepEqual(
transformArguments('from', 'to'),
['RENAMENX', 'from', 'to']
);
});
it('transformArguments', () => {
assert.deepEqual(
RENAMENX.transformArguments('source', 'destination'),
['RENAMENX', 'source', 'destination']
);
});
testUtils.testWithClient('client.renameNX', async client => {
await client.set('from', 'value');
testUtils.testAll('renameNX', async client => {
const [, reply] = await Promise.all([
client.set('{tag}source', 'value'),
client.renameNX('{tag}source', '{tag}destination')
]);
assert.equal(
await client.renameNX('from', 'to'),
true
);
}, GLOBAL.SERVERS.OPEN);
assert.equal(reply, 1);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});