You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-03 04:01:40 +03:00
* wip * improve the vadd api * resp3 tests * fix some tests * extract json helper functions in client package * use transformJsonReply * remove the CACHEABLE flag for all vector set commands currently, client side caching is not supported for vector set commands by the server * properly transform vinfo result * add resp3 test for vlinks * add more tests for vrandmember * fix vrem return types * fix vsetattr return type * fix vsim_withscores * implement vlinks_withscores * set minimum docker image version to 8 * align return types * add RAW variant for VEMB -> VEMB_RAW * use the new parseCommand api
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { strict as assert } from 'node:assert';
|
|
import testUtils, { GLOBAL } from '../test-utils';
|
|
import VEMB from './VEMB';
|
|
import { BasicCommandParser } from '../client/parser';
|
|
|
|
describe('VEMB', () => {
|
|
it('parseCommand', () => {
|
|
const parser = new BasicCommandParser();
|
|
VEMB.parseCommand(parser, 'key', 'element');
|
|
assert.deepEqual(
|
|
parser.redisArgs,
|
|
['VEMB', 'key', 'element']
|
|
);
|
|
});
|
|
|
|
testUtils.testAll('vEmb', async client => {
|
|
await client.vAdd('key', [1.0, 2.0, 3.0], 'element');
|
|
|
|
const result = await client.vEmb('key', 'element');
|
|
assert.ok(Array.isArray(result));
|
|
assert.equal(result.length, 3);
|
|
assert.equal(typeof result[0], 'number');
|
|
}, {
|
|
client: { ...GLOBAL.SERVERS.OPEN, minimumDockerVersion: [8, 0] },
|
|
cluster: { ...GLOBAL.CLUSTERS.OPEN, minimumDockerVersion: [8, 0] }
|
|
});
|
|
|
|
testUtils.testWithClient('vEmb with RESP3', async client => {
|
|
await client.vAdd('resp3-key', [1.5, 2.5, 3.5, 4.5], 'resp3-element');
|
|
|
|
const result = await client.vEmb('resp3-key', 'resp3-element');
|
|
assert.ok(Array.isArray(result));
|
|
assert.equal(result.length, 4);
|
|
assert.equal(typeof result[0], 'number');
|
|
}, {
|
|
...GLOBAL.SERVERS.OPEN,
|
|
clientOptions: {
|
|
RESP: 3
|
|
},
|
|
minimumDockerVersion: [8, 0]
|
|
});
|
|
});
|