You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
use dockers for tests, use npm workspaces, add rejson & redisearch modules, fix some bugs
This commit is contained in:
81
packages/client/lib/commands/GEOSEARCHSTORE.spec.ts
Normal file
81
packages/client/lib/commands/GEOSEARCHSTORE.spec.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments, transformReply } from './GEOSEARCHSTORE';
|
||||
|
||||
describe('GEOSEARCHSTORE', () => {
|
||||
testUtils.isVersionGreaterThanHook([6, 2]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
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']
|
||||
);
|
||||
});
|
||||
|
||||
it('with STOREDIST', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('destination', 'source', 'member', {
|
||||
radius: 1,
|
||||
unit: 'm'
|
||||
}, {
|
||||
SORT: 'ASC',
|
||||
COUNT: {
|
||||
value: 1,
|
||||
ANY: true
|
||||
},
|
||||
STOREDIST: true
|
||||
}),
|
||||
['GEOSEARCHSTORE', 'destination', 'source', 'FROMMEMBER', 'member', 'BYRADIUS', '1', 'm', 'ASC', 'COUNT', '1', 'ANY', 'STOREDIST']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('transformReply with empty array (https://github.com/redis/redis/issues/9261)', () => {
|
||||
assert.throws(
|
||||
() => (transformReply as any)([]),
|
||||
TypeError
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.geoSearchStore', async client => {
|
||||
await client.geoAdd('source', {
|
||||
longitude: 1,
|
||||
latitude: 1,
|
||||
member: 'member'
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
await client.geoSearchStore('destination', 'source', 'member', {
|
||||
radius: 1,
|
||||
unit: 'm'
|
||||
}),
|
||||
1
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
testUtils.testWithCluster('cluster.geoSearchStore', async cluster => {
|
||||
await cluster.geoAdd('{tag}source', {
|
||||
longitude: 1,
|
||||
latitude: 1,
|
||||
member: 'member'
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
await cluster.geoSearchStore('{tag}destination', '{tag}source', 'member', {
|
||||
radius: 1,
|
||||
unit: 'm'
|
||||
}),
|
||||
1
|
||||
);
|
||||
}, GLOBAL.CLUSTERS.OPEN);
|
||||
});
|
Reference in New Issue
Block a user