You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Support all GEORADIUS Commands (#2017)
* Support all GEORADIUS Commands * move store bool to options * simplify transformReply for store commands * clean code Co-authored-by: leibale <leibale1998@gmail.com>
This commit is contained in:
40
packages/client/lib/commands/GEORADIUS_WITH.spec.ts
Normal file
40
packages/client/lib/commands/GEORADIUS_WITH.spec.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { RedisCommandArguments } from '.';
|
||||
import { GeoReplyWith } from './generic-transformers';
|
||||
import { transformArguments } from './GEORADIUS_WITH';
|
||||
|
||||
describe('GEORADIUS WITH', () => {
|
||||
it('transformArguments', () => {
|
||||
const expectedReply: RedisCommandArguments = ['GEORADIUS', 'key', '1', '2', '3', 'm', 'WITHDIST'];
|
||||
expectedReply.preserve = ['WITHDIST'];
|
||||
|
||||
assert.deepEqual(
|
||||
transformArguments('key', {
|
||||
longitude: 1,
|
||||
latitude: 2
|
||||
}, 3 , 'm', [GeoReplyWith.DISTANCE]),
|
||||
expectedReply
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.geoRadiusWith', async client => {
|
||||
assert.deepEqual(
|
||||
await client.geoRadiusWith('key', {
|
||||
longitude: 1,
|
||||
latitude: 2
|
||||
}, 3 , 'm', [GeoReplyWith.DISTANCE]),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
testUtils.testWithCluster('cluster.geoRadiusWith', async cluster => {
|
||||
assert.deepEqual(
|
||||
await cluster.geoRadiusWith('key', {
|
||||
longitude: 1,
|
||||
latitude: 2
|
||||
}, 3 , 'm', [GeoReplyWith.DISTANCE]),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.CLUSTERS.OPEN);
|
||||
});
|
Reference in New Issue
Block a user