Browse Source

fix(microservice-schema) schema: add unit test

pull/909/head
missinglink 8 years ago
parent
commit
d68cd7a044
  1. 23
      test/unit/schema.js

23
test/unit/schema.js

@ -484,6 +484,29 @@ module.exports.tests.api_services_validation = (test, common) => {
}; };
module.exports.tests.placeholder_service_validation = (test, common) => { module.exports.tests.placeholder_service_validation = (test, common) => {
test('timeout and retries not specified should default to 250 and 3', (t) => {
const config = {
api: {
version: 'version value',
indexName: 'index name value',
host: 'host value',
services: {
placeholder: {
url: 'http://localhost'
}
}
},
esclient: {}
};
const result = Joi.validate(config, schema);
t.equals(result.value.api.services.placeholder.timeout, 250);
t.equals(result.value.api.services.placeholder.retries, 3);
t.end();
});
test('when api.services.placeholder is defined, url is required', (t) => { test('when api.services.placeholder is defined, url is required', (t) => {
var config = { var config = {
api: { api: {

Loading…
Cancel
Save