You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
add cluster.duplicate, add some tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils';
|
||||
import { transformArguments } from './GEOPOS';
|
||||
import { transformArguments, transformReply } from './GEOPOS';
|
||||
|
||||
describe('GEOPOS', () => {
|
||||
describe('transformArguments', () => {
|
||||
@@ -19,11 +19,49 @@ describe('GEOPOS', () => {
|
||||
});
|
||||
});
|
||||
|
||||
itWithClient(TestRedisServers.OPEN, 'client.geoPos', async client => {
|
||||
assert.deepEqual(
|
||||
await client.geoPos('key', 'member'),
|
||||
[null]
|
||||
);
|
||||
describe('transformReply', () => {
|
||||
it('null', () => {
|
||||
assert.deepEqual(
|
||||
transformReply([null]),
|
||||
[null]
|
||||
);
|
||||
});
|
||||
|
||||
it('with member', () => {
|
||||
assert.deepEqual(
|
||||
transformReply([['1', '2']]),
|
||||
[{
|
||||
longitude: '1',
|
||||
latitude: '2'
|
||||
}]
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('client.geoPos', () => {
|
||||
itWithClient(TestRedisServers.OPEN, 'null', async client => {
|
||||
assert.deepEqual(
|
||||
await client.geoPos('key', 'member'),
|
||||
[null]
|
||||
);
|
||||
});
|
||||
|
||||
itWithClient(TestRedisServers.OPEN, 'with member', async client => {
|
||||
const coordinates = {
|
||||
longitude: '-122.06429868936538696',
|
||||
latitude: '37.37749628831998194'
|
||||
};
|
||||
|
||||
await client.geoAdd('key', {
|
||||
member: 'member',
|
||||
...coordinates
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
await client.geoPos('key', 'member'),
|
||||
[coordinates]
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
itWithCluster(TestRedisClusters.OPEN, 'cluster.geoPos', async cluster => {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster, describeHandleMinimumRedisVersion } from '../test-utils';
|
||||
import { transformArguments } from './GEOSEARCHSTORE';
|
||||
import { transformArguments, transformReply } from './GEOSEARCHSTORE';
|
||||
|
||||
describe('GEOSEARCHSTORE', () => {
|
||||
describeHandleMinimumRedisVersion([6, 2]);
|
||||
@@ -40,6 +40,13 @@ describe('GEOSEARCHSTORE', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('transformReply with empty array (https://github.com/redis/redis/issues/9261)', () => {
|
||||
assert.throws(
|
||||
() => (transformReply as any)([]),
|
||||
TypeError
|
||||
);
|
||||
});
|
||||
|
||||
itWithClient(TestRedisServers.OPEN, 'client.geoSearchStore', async client => {
|
||||
await client.geoAdd('source', {
|
||||
longitude: 1,
|
||||
|
@@ -33,7 +33,7 @@ describe('PUBSUB NUMSUB', () => {
|
||||
);
|
||||
});
|
||||
|
||||
itWithCluster(TestRedisClusters.OPEN, 'cluster.pubSubNumPat', async cluster => {
|
||||
itWithCluster(TestRedisClusters.OPEN, 'cluster.pubSubNumSub', async cluster => {
|
||||
assert.deepEqual(
|
||||
await cluster.pubSubNumSub(),
|
||||
Object.create(null)
|
||||
|
Reference in New Issue
Block a user