| 1 |
import { strict as assert } from 'assert'; |
| 2 |
import { SchemaFieldTypes } from '.'; |
| 3 |
import testUtils, { GLOBAL } from '../test-utils'; |
| 4 |
import { transformArguments } from './CURSOR_DEL'; |
| 5 |
|
| 6 |
describe('CURSOR DEL', () => { |
| 7 |
it('transformArguments', () => { |
| 8 |
assert.deepEqual( |
| 9 |
transformArguments('index', 0), |
| 10 |
['FT.CURSOR', 'DEL', 'index', '0'] |
| 11 |
); |
| 12 |
}); |
| 13 |
|
| 14 |
testUtils.testWithClient('client.ft.cursorDel', async client => { |
| 15 |
const [ ,, { cursor } ] = await Promise.all([ |
| 16 |
client.ft.create('idx', { |
| 17 |
field: { |
| 18 |
type: SchemaFieldTypes.TEXT |
| 19 |
} |
| 20 |
}), |
| 21 |
client.hSet('key', 'field', 'value'), |
| 22 |
client.ft.aggregateWithCursor('idx', '*', { |
| 23 |
COUNT: 1 |
| 24 |
}) |
| 25 |
]); |
| 26 |
|
| 27 |
|
| 28 |
assert.equal( |
| 29 |
await client.ft.cursorDel('idx', cursor), |
| 30 |
'OK' |
| 31 |
); |
| 32 |
}, GLOBAL.SERVERS.OPEN); |
| 33 |
}); |