1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-22 05:32:45 +03:00

implement some GEO commands, improve scan generic transformer, expose RPUSHX

This commit is contained in:
leibale
2021-07-19 16:39:09 -04:00
parent c72aab2fc2
commit a10b276144
24 changed files with 924 additions and 59 deletions

View File

@@ -0,0 +1,40 @@
import { strict as assert } from 'assert';
import { TransformArgumentsReply } from '.';
import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils';
import { GeoReplyWith } from './generic-transformers';
import { transformArguments } from './GEOSEARCH_WITH';
describe('GEOSEARCH WITH', () => {
it('transformArguments', () => {
const expectedReply: TransformArgumentsReply = ['GEOSEARCH', 'key', 'FROMMEMBER', 'member', 'BYRADIUS', '1', 'm', 'WITHDIST']
expectedReply.preserve = ['WITHDIST'];
assert.deepEqual(
transformArguments('key', 'member', {
radius: 1,
unit: 'm'
}, [GeoReplyWith.DISTANCE]),
expectedReply
);
});
itWithClient(TestRedisServers.OPEN, 'client.geoSearchWith', async client => {
assert.deepEqual(
await client.geoSearchWith('key', 'member', {
radius: 1,
unit: 'm'
}, [GeoReplyWith.DISTANCE]),
[]
);
});
itWithCluster(TestRedisClusters.OPEN, 'cluster.geoSearchWith', async cluster => {
assert.deepEqual(
await cluster.geoSearchWith('key', 'member', {
radius: 1,
unit: 'm'
}, [GeoReplyWith.DISTANCE]),
[]
);
});
});