|
1 | 1 | import { strict as assert } from 'node:assert';
|
2 |
| -import { SchemaFieldTypes } from '.'; |
3 | 2 | import testUtils, { GLOBAL } from '../test-utils';
|
4 |
| -import { transformArguments } from './CURSOR_READ'; |
| 3 | +import CURSOR_READ from './CURSOR_READ'; |
5 | 4 |
|
6 |
| -describe('CURSOR READ', () => { |
7 |
| - describe('transformArguments', () => { |
8 |
| - it('without options', () => { |
9 |
| - assert.deepEqual( |
10 |
| - transformArguments('index', 0), |
11 |
| - ['FT.CURSOR', 'READ', 'index', '0'] |
12 |
| - ); |
13 |
| - }); |
| 5 | +describe('FT.CURSOR READ', () => { |
| 6 | + describe('transformArguments', () => { |
| 7 | + it('without options', () => { |
| 8 | + assert.deepEqual( |
| 9 | + CURSOR_READ.transformArguments('index', '0'), |
| 10 | + ['FT.CURSOR', 'READ', 'index', '0'] |
| 11 | + ); |
| 12 | + }); |
14 | 13 |
|
15 |
| - it('with COUNT', () => { |
16 |
| - assert.deepEqual( |
17 |
| - transformArguments('index', 0, { COUNT: 1 }), |
18 |
| - ['FT.CURSOR', 'READ', 'index', '0', 'COUNT', '1'] |
19 |
| - ); |
20 |
| - }); |
| 14 | + it('with COUNT', () => { |
| 15 | + assert.deepEqual( |
| 16 | + CURSOR_READ.transformArguments('index', '0', { |
| 17 | + COUNT: 1 |
| 18 | + }), |
| 19 | + ['FT.CURSOR', 'READ', 'index', '0', 'COUNT', '1'] |
| 20 | + ); |
21 | 21 | });
|
| 22 | + }); |
22 | 23 |
|
23 |
| - testUtils.testWithClient('client.ft.cursorRead', async client => { |
24 |
| - const [, , { cursor }] = await Promise.all([ |
25 |
| - client.ft.create('idx', { |
26 |
| - field: { |
27 |
| - type: SchemaFieldTypes.TEXT |
28 |
| - } |
29 |
| - }), |
30 |
| - client.hSet('key', 'field', 'value'), |
31 |
| - client.ft.aggregateWithCursor('idx', '*', { |
32 |
| - COUNT: 1 |
33 |
| - }) |
34 |
| - ]); |
| 24 | + testUtils.testWithClient('client.ft.cursorRead', async client => { |
| 25 | + const [, , { cursor }] = await Promise.all([ |
| 26 | + client.ft.create('idx', { |
| 27 | + field: 'TEXT' |
| 28 | + }), |
| 29 | + client.hSet('key', 'field', 'value'), |
| 30 | + client.ft.aggregateWithCursor('idx', '*', { |
| 31 | + COUNT: 1 |
| 32 | + }) |
| 33 | + ]); |
35 | 34 |
|
36 |
| - assert.deepEqual( |
37 |
| - await client.ft.cursorRead('idx', cursor), |
38 |
| - { |
39 |
| - total: 0, |
40 |
| - results: [], |
41 |
| - cursor: 0 |
42 |
| - } |
43 |
| - ); |
44 |
| - }, GLOBAL.SERVERS.OPEN); |
| 35 | + assert.deepEqual( |
| 36 | + await client.ft.cursorRead('idx', cursor), |
| 37 | + { |
| 38 | + total: 0, |
| 39 | + results: [], |
| 40 | + cursor: '0' |
| 41 | + } |
| 42 | + ); |
| 43 | + }, GLOBAL.SERVERS.OPEN); |
45 | 44 | });
|
0 commit comments