You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Merge branch 'v4.0' of github.com:redis/node-redis
This commit is contained in:
@@ -5,32 +5,21 @@ import { transformArguments } from './LINDEX';
|
||||
describe('LINDEX', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', 0),
|
||||
['LINDEX', 'key', '0']
|
||||
transformArguments('key', 'element'),
|
||||
['LINDEX', 'key', 'element']
|
||||
);
|
||||
});
|
||||
|
||||
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.testWithClient('client.lIndex', async client => {
|
||||
assert.equal(
|
||||
await client.lIndex('key', 'element'),
|
||||
null
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
testUtils.testWithCluster('cluster.lIndex', async cluster => {
|
||||
assert.equal(
|
||||
await cluster.lIndex('key', 0),
|
||||
await cluster.lIndex('key', 'element'),
|
||||
null
|
||||
);
|
||||
}, GLOBAL.CLUSTERS.OPEN);
|
||||
|
@@ -2,8 +2,8 @@ export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(key: string, index: number): Array<string> {
|
||||
return ['LINDEX', key, index.toString()];
|
||||
export function transformArguments(key: string, element: string): Array<string> {
|
||||
return ['LINDEX', key, element];
|
||||
}
|
||||
|
||||
export declare function transformReply(): string | null;
|
||||
|
@@ -1,6 +1,4 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
|
||||
export function transformArguments(channel: string | Buffer, message: string | Buffer): RedisCommandArguments {
|
||||
export function transformArguments(channel: string, message: string): Array<string> {
|
||||
return ['PUBLISH', channel, message];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user