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/ALTER.spec.ts
Avital Fine 01e66e7c8f Search commands (#1778)
* ft.alter

* ft.profile
2021-12-13 16:28:04 +01:00

38 lines
1.1 KiB
TypeScript

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