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
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { strict as assert } from 'assert';
|
|
import testUtils, { GLOBAL } from '../test-utils';
|
|
import SEARCH_NOCONTENT from './SEARCH_NOCONTENT';
|
|
import { parseArgs } from '@redis/client/lib/commands/generic-transformers';
|
|
import { DEFAULT_DIALECT } from '../dialect/default';
|
|
|
|
describe('FT.SEARCH NOCONTENT', () => {
|
|
describe('transformArguments', () => {
|
|
it('without options', () => {
|
|
assert.deepEqual(
|
|
parseArgs(SEARCH_NOCONTENT, 'index', 'query'),
|
|
['FT.SEARCH', 'index', 'query', 'DIALECT', DEFAULT_DIALECT, 'NOCONTENT']
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('client.ft.searchNoContent', () => {
|
|
testUtils.testWithClient('returns total and keys', async client => {
|
|
await Promise.all([
|
|
client.ft.create('index', {
|
|
field: 'TEXT'
|
|
}),
|
|
client.hSet('1', 'field', 'field1'),
|
|
client.hSet('2', 'field', 'field2')
|
|
]);
|
|
|
|
assert.deepEqual(
|
|
await client.ft.searchNoContent('index', '*'),
|
|
{
|
|
total: 2,
|
|
documents: ['1', '2']
|
|
}
|
|
);
|
|
}, GLOBAL.SERVERS.OPEN);
|
|
});
|
|
});
|