1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

fix GEO* commands

This commit is contained in:
Leibale
2023-05-08 11:04:22 +03:00
parent d2e244a77d
commit 6a0b4db4f7
37 changed files with 1115 additions and 990 deletions

View File

@@ -0,0 +1,48 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import GEORADIUS_STORE from './GEORADIUS_STORE';
describe('GEORADIUS STORE', () => {
describe('transformArguments', () => {
it('STORE', () => {
assert.deepEqual(
GEORADIUS_STORE.transformArguments('key', {
longitude: 1,
latitude: 2
}, 3, 'm', 'destination'),
['GEORADIUS', 'key', '1', '2', '3', 'm', 'STORE', 'destination']
);
});
it('STOREDIST', () => {
assert.deepEqual(
GEORADIUS_STORE.transformArguments('key', {
longitude: 1,
latitude: 2
}, 3, 'm', 'destination', {
STOREDIST: true
}),
['GEORADIUS', 'key', '1', '2', '3', 'm', 'STOREDIST', 'destination']
);
});
});
testUtils.testAll('geoRadiusStore', async client => {
const [, reply] = await Promise.all([
client.geoAdd('{tag}source', {
longitude: 1,
latitude: 2,
member: 'member'
}),
client.geoRadiusStore('{tag}source', {
longitude: 1,
latitude: 2
}, 1, 'm', '{tag}destination')
]);
assert.equal(reply, 1);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});