You've already forked node-redis
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:
40
lib/commands/GEOSEARCH_WITH.spec.ts
Normal file
40
lib/commands/GEOSEARCH_WITH.spec.ts
Normal 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]),
|
||||
[]
|
||||
);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user