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

fix merge

This commit is contained in:
leibale
2021-11-24 21:37:31 -05:00
parent 96a73db0b4
commit c74e043ee1
5 changed files with 189 additions and 118 deletions

View File

@@ -1,26 +1,36 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './LINDEX';
describe('LINDEX', () => {
it('transformArguments', () => {
assert.deepEqual(
transformArguments('key', 'element'),
['LINDEX', 'key', 'element']
transformArguments('key', 0),
['LINDEX', 'key', '0']
);
});
testUtils.testWithClient('client.lIndex', async client => {
assert.equal(
await client.lIndex('key', 'element'),
null
);
}, GLOBAL.SERVERS.OPEN);
describe('client.lIndex', () => {
testUtils.testWithClient('null', async client => {
assert.equal(
await client.lIndex('key', 0),
null
);
}, GLOBAL.SERVERS.OPEN);
testUtils.testWithClient('with value', async client => {
const [, lIndexReply] = await Promise.all([
client.lPush('key', 'element'),
client.lIndex('key', 0)
]);
assert.equal(lIndexReply, 'element');
}, GLOBAL.SERVERS.OPEN);
});
testUtils.testWithCluster('cluster.lIndex', async cluster => {
assert.equal(
await cluster.lIndex('key', 'element'),
await cluster.lIndex('key', 0),
null
);
}, GLOBAL.CLUSTERS.OPEN);
});
});