-
Notifications
You must be signed in to change notification settings - Fork 208
/
Copy pathoptimize-test.ts
46 lines (44 loc) · 1.62 KB
/
optimize-test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import * as figc from 'figc';
import { createClient } from '../lib/solr';
import * as sassert from './utils/sassert';
import { dataOk } from './utils/sassert';
import { assert } from 'chai';
const config = figc(__dirname + '/config.json');
const client = createClient(config.client);
[config.client.path, config.client.core].join('/').replace(/\/$/, '');
describe('Client', function () {
describe('#optimize(callback)', function () {
it('should optimize', async function () {
const data = await client.optimize({});
dataOk(data);
});
});
describe('#optimize({softCommit : true},callback)', function () {
it('should optimize with the option softCommit enabled', async function () {
const data = await client.optimize({ softCommit: true });
dataOk(data);
});
});
describe('#optimize({waitSearcher : true},callback)', function () {
it('should optimize with the option waitSearcher enabled', async function () {
const data = await client.optimize({ waitSearcher: true });
dataOk(data);
});
});
describe('#optimize({maxSegments : 2},callback)', function () {
it('should optimize with the option maxSegments set to 2', async function () {
const data = await client.optimize({ maxSegments: 2 });
dataOk(data);
});
});
describe('#optimize({unknownOption : true},callback)', function () {
it('should return a `SolrError`', async function () {
try {
await client.optimize({ unknownOption: true });
throw new Error('Should not reach this');
} catch (err: any) {
assert.include(err.message, 'unknownOption');
}
});
});
});