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,41 @@
import { strict as assert } from 'assert';
import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils';
import { transformArguments } from './GEOSEARCHSTORE';
describe('GEOSEARCHSTORE', () => {
it('transformArguments', () => {
assert.deepEqual(
transformArguments('destination', 'source', 'member', {
radius: 1,
unit: 'm'
}, {
SORT: 'ASC',
COUNT: {
value: 1,
ANY: true
}
}),
['GEOSEARCHSTORE', 'destination', 'source', 'FROMMEMBER', 'member', 'BYRADIUS', '1', 'm', 'ASC', 'COUNT', '1', 'ANY']
);
});
itWithClient(TestRedisServers.OPEN, 'client.geoSearchStore', async client => {
assert.equal(
await client.geoSearchStore('source', 'destination', 'member', {
radius: 1,
unit: 'm'
}),
0
);
});
itWithCluster(TestRedisClusters.OPEN, 'cluster.geoSearchStore', async cluster => {
assert.equal(
await cluster.geoSearchStore('{tag}source', '{tag}destination', 'member', {
radius: 1,
unit: 'm'
}),
0
);
});
});