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
64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
import { strict as assert } from 'node:assert';
|
|
import testUtils, { GLOBAL } from '../test-utils';
|
|
import VREM from './VREM';
|
|
import { BasicCommandParser } from '../client/parser';
|
|
|
|
describe('VREM', () => {
|
|
const parser = new BasicCommandParser();
|
|
VREM.parseCommand(parser, 'key', 'element');
|
|
it('parseCommand', () => {
|
|
assert.deepEqual(
|
|
parser.redisArgs,
|
|
['VREM', 'key', 'element']
|
|
);
|
|
});
|
|
|
|
testUtils.testAll('vRem', async client => {
|
|
await client.vAdd('key', [1.0, 2.0, 3.0], 'element');
|
|
|
|
assert.equal(
|
|
await client.vRem('key', 'element'),
|
|
true
|
|
);
|
|
|
|
assert.equal(
|
|
await client.vRem('key', 'element'),
|
|
false
|
|
);
|
|
|
|
assert.equal(
|
|
await client.vCard('key'),
|
|
0
|
|
);
|
|
}, {
|
|
client: { ...GLOBAL.SERVERS.OPEN, minimumDockerVersion: [8, 0] },
|
|
cluster: { ...GLOBAL.CLUSTERS.OPEN, minimumDockerVersion: [8, 0] }
|
|
});
|
|
|
|
testUtils.testWithClient('vRem with RESP3', async client => {
|
|
await client.vAdd('resp3-key', [1.0, 2.0, 3.0], 'resp3-element');
|
|
|
|
assert.equal(
|
|
await client.vRem('resp3-key', 'resp3-element'),
|
|
true
|
|
);
|
|
|
|
assert.equal(
|
|
await client.vRem('resp3-key', 'resp3-element'),
|
|
false
|
|
);
|
|
|
|
|
|
assert.equal(
|
|
await client.vCard('resp3-key'),
|
|
0
|
|
);
|
|
}, {
|
|
...GLOBAL.SERVERS.OPEN,
|
|
clientOptions: {
|
|
RESP: 3
|
|
},
|
|
minimumDockerVersion: [8, 0]
|
|
});
|
|
});
|