diff --git a/src/configValidation.js b/src/configValidation.js index c0248f1..cdc8e37 100644 --- a/src/configValidation.js +++ b/src/configValidation.js @@ -15,7 +15,8 @@ const schema = Joi.object().keys({ requestTimeout: Joi.number().integer().min(0) }).unknown(true), schema: Joi.object().keys({ - indexName: Joi.string().required() + indexName: Joi.string().required(), + icuTokenizer: Joi.boolean().optional() }) }).unknown(true); diff --git a/test/configValidation.js b/test/configValidation.js index dbed9ab..483d6fc 100644 --- a/test/configValidation.js +++ b/test/configValidation.js @@ -7,6 +7,34 @@ const intercept = require('intercept-stdout'); module.exports.tests = {}; module.exports.tests.validate = function(test, common) { + test('config with icuTokenizer should not throw', function(t) { + var config = { + dbclient: { + batchSize: 500, + statFrequency: 100 + }, + esclient: { + requestTimeout: 500 + }, + schema: { + indexName: 'example_index', + icuTokenizer: true + } + }; + + t.doesNotThrow(function() { + proxyquire('../src/configValidation', { + 'elasticsearch': { + Client: function() { + return { indices: { exists: (indexName, cb) => { cb(false, true); } } }; + } + } + }).validate(config); + }); + t.end(); + + }); + test('config without dbclient should throw error', function(t) { var config = { esclient: {},