You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
V5 bringing RESP3, Sentinel and TypeMapping to node-redis
RESP3 Support - Some commands responses in RESP3 aren't stable yet and therefore return an "untyped" ReplyUnion. Sentinel TypeMapping Correctly types Multi commands Note: some API changes to be further documented in v4-to-v5.md
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { strict as assert } from 'node:assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './SUGGET_WITHSCORES';
|
||||
import SUGGET_WITHSCORES from './SUGGET_WITHSCORES';
|
||||
|
||||
describe('SUGGET WITHSCORES', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', 'prefix'),
|
||||
['FT.SUGGET', 'key', 'prefix', 'WITHSCORES']
|
||||
);
|
||||
});
|
||||
describe('FT.SUGGET WITHSCORES', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
SUGGET_WITHSCORES.transformArguments('key', 'prefix'),
|
||||
['FT.SUGGET', 'key', 'prefix', 'WITHSCORES']
|
||||
);
|
||||
});
|
||||
|
||||
describe('client.ft.sugGetWithScores', () => {
|
||||
testUtils.testWithClient('null', async client => {
|
||||
assert.equal(
|
||||
await client.ft.sugGetWithScores('key', 'prefix'),
|
||||
null
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
describe('client.ft.sugGetWithScores', () => {
|
||||
testUtils.testWithClient('null', async client => {
|
||||
assert.equal(
|
||||
await client.ft.sugGetWithScores('key', 'prefix'),
|
||||
null
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
testUtils.testWithClient('with suggestions', async client => {
|
||||
await client.ft.sugAdd('key', 'string', 1);
|
||||
testUtils.testWithClient('with suggestions', async client => {
|
||||
const [, reply] = await Promise.all([
|
||||
client.ft.sugAdd('key', 'string', 1),
|
||||
client.ft.sugGetWithScores('key', 's')
|
||||
]);
|
||||
|
||||
assert.deepEqual(
|
||||
await client.ft.sugGetWithScores('key', 'string'),
|
||||
[{
|
||||
suggestion: 'string',
|
||||
score: 2147483648
|
||||
}]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
assert.ok(Array.isArray(reply));
|
||||
assert.equal(reply.length, 1);
|
||||
assert.equal(reply[0].suggestion, 'string');
|
||||
assert.equal(typeof reply[0].score, 'number');
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user