1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

Search commands (#1778)

* ft.alter

* ft.profile
This commit is contained in:
Avital Fine
2021-12-13 16:28:04 +01:00
committed by GitHub
parent 0865d22777
commit 01e66e7c8f
19 changed files with 581 additions and 272 deletions

View File

@@ -0,0 +1,37 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './ALTER';
import { SchemaFieldTypes } from '.';
describe('ALTER', () => {
describe('transformArguments', () => {
it('with NOINDEX', () => {
assert.deepEqual(
transformArguments('index', {
field: {
type: SchemaFieldTypes.TEXT,
NOINDEX: true,
SORTABLE: 'UNF',
AS: 'text'
}
}),
['FT.ALTER', 'index', 'SCHEMA', 'ADD', 'field', 'AS', 'text', 'TEXT', 'SORTABLE', 'UNF', 'NOINDEX']
);
});
});
testUtils.testWithClient('client.ft.create', async client => {
await Promise.all([
client.ft.create('index', {
title: SchemaFieldTypes.TEXT
}),
]);
assert.equal(
await client.ft.alter('index', {
body: SchemaFieldTypes.TEXT
}),
'OK'
);
}, GLOBAL.SERVERS.OPEN);
});