1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-10 11:43:01 +03:00
This commit is contained in:
Leibale
2023-05-03 17:29:36 -04:00
parent 4304f4dba3
commit 331e390bef
79 changed files with 822 additions and 719 deletions

View File

@@ -1,36 +1,22 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './LINDEX';
import LINDEX from './LINDEX';
describe('LINDEX', () => {
it('transformArguments', () => {
assert.deepEqual(
transformArguments('key', 0),
['LINDEX', 'key', '0']
);
});
it('transformArguments', () => {
assert.deepEqual(
LINDEX.transformArguments('key', 0),
['LINDEX', 'key', '0']
);
});
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', 0),
null
);
}, GLOBAL.CLUSTERS.OPEN);
testUtils.testAll('lIndex', async client => {
assert.equal(
await client.lIndex('key', 0),
null
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});