| 1 |
import { strict as assert } from 'assert'; |
| 2 |
import testUtils, { GLOBAL } from '../test-utils'; |
| 3 |
import { transformArguments } from './ALTER'; |
| 4 |
import { SchemaFieldTypes } from '.'; |
| 5 |
|
| 6 |
describe('ALTER', () => { |
| 7 |
describe('transformArguments', () => { |
| 8 |
it('with NOINDEX', () => { |
| 9 |
assert.deepEqual( |
| 10 |
transformArguments('index', { |
| 11 |
field: { |
| 12 |
type: SchemaFieldTypes.TEXT, |
| 13 |
NOINDEX: true, |
| 14 |
SORTABLE: 'UNF', |
| 15 |
AS: 'text' |
| 16 |
} |
| 17 |
}), |
| 18 |
['FT.ALTER', 'index', 'SCHEMA', 'ADD', 'field', 'AS', 'text', 'TEXT', 'SORTABLE', 'UNF', 'NOINDEX'] |
| 19 |
); |
| 20 |
}); |
| 21 |
}); |
| 22 |
|
| 23 |
testUtils.testWithClient('client.ft.create', async client => { |
| 24 |
await Promise.all([ |
| 25 |
client.ft.create('index', { |
| 26 |
title: SchemaFieldTypes.TEXT |
| 27 |
}), |
| 28 |
]); |
| 29 |
|
| 30 |
assert.equal( |
| 31 |
await client.ft.alter('index', { |
| 32 |
body: SchemaFieldTypes.TEXT |
| 33 |
}), |
| 34 |
'OK' |
| 35 |
); |
| 36 |
}, GLOBAL.SERVERS.OPEN); |
| 37 |
}); |