You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
37
packages/search/lib/commands/AGGREGATE_WITHCURSOR.spec.ts
Normal file
37
packages/search/lib/commands/AGGREGATE_WITHCURSOR.spec.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './AGGREGATE_WITHCURSOR';
|
||||
import { SchemaFieldTypes } from '.';
|
||||
|
||||
describe('AGGREGATE WITHCURSOR', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('without options', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('index', '*'),
|
||||
['FT.AGGREGATE', 'index', '*', 'WITHCURSOR']
|
||||
);
|
||||
});
|
||||
|
||||
it('with COUNT', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('index', '*', { COUNT: 1 }),
|
||||
['FT.AGGREGATE', 'index', '*', 'WITHCURSOR', 'COUNT', '1']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.ft.aggregateWithCursor', async client => {
|
||||
await client.ft.create('index', {
|
||||
field: SchemaFieldTypes.NUMERIC
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
await client.ft.aggregateWithCursor('index', '*'),
|
||||
{
|
||||
total: 0,
|
||||
results: [],
|
||||
cursor: 0
|
||||
}
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
Reference in New Issue
Block a user