1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
Files
node-redis/packages/search/lib/commands/SEARCH_NOCONTENT.spec.ts
Hristo Temelski 1af01373db feat(search): Set default dialect to 2 for Redis Search commands (#2895)
- The default dialect `DEFAULT_DIALECT`  is now set to '2'
- Automatically append DIALECT parameter to search commands when not explicitly specified
2025-02-17 13:47:12 +02:00

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);
});
});