You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
- The default dialect `DEFAULT_DIALECT` is now set to '2' - Automatically append DIALECT parameter to search commands when not explicitly specified
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import { strict as assert } from 'node:assert';
|
|
import testUtils, { GLOBAL } from '../test-utils';
|
|
import AGGREGATE_WITHCURSOR from './AGGREGATE_WITHCURSOR';
|
|
import { parseArgs } from '@redis/client/lib/commands/generic-transformers';
|
|
import { DEFAULT_DIALECT } from '../dialect/default';
|
|
|
|
describe('AGGREGATE WITHCURSOR', () => {
|
|
describe('transformArguments', () => {
|
|
it('without options', () => {
|
|
assert.deepEqual(
|
|
parseArgs(AGGREGATE_WITHCURSOR, 'index', '*'),
|
|
['FT.AGGREGATE', 'index', '*', 'DIALECT', DEFAULT_DIALECT, 'WITHCURSOR']
|
|
);
|
|
});
|
|
|
|
it('with COUNT', () => {
|
|
assert.deepEqual(
|
|
parseArgs(AGGREGATE_WITHCURSOR, 'index', '*', {
|
|
COUNT: 1
|
|
}),
|
|
['FT.AGGREGATE', 'index', '*', 'DIALECT', DEFAULT_DIALECT, 'WITHCURSOR', 'COUNT', '1']
|
|
);
|
|
});
|
|
|
|
it('with MAXIDLE', () => {
|
|
assert.deepEqual(
|
|
parseArgs(AGGREGATE_WITHCURSOR, 'index', '*', {
|
|
MAXIDLE: 1
|
|
}),
|
|
['FT.AGGREGATE', 'index', '*', 'DIALECT', DEFAULT_DIALECT, 'WITHCURSOR', 'MAXIDLE', '1']
|
|
);
|
|
});
|
|
});
|
|
|
|
testUtils.testWithClient('client.ft.aggregateWithCursor', async client => {
|
|
await client.ft.create('index', {
|
|
field: 'NUMERIC'
|
|
});
|
|
|
|
assert.deepEqual(
|
|
await client.ft.aggregateWithCursor('index', '*'),
|
|
{
|
|
total: 0,
|
|
results: [],
|
|
cursor: 0
|
|
}
|
|
);
|
|
}, GLOBAL.SERVERS.OPEN);
|
|
});
|